This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.util.Base64 | |
import android.util.Base64InputStream | |
import org.apache.commons.io.input.ReaderInputStream //implementation 'commons-io:commons-io:2.19.0' https://central.sonatype.com/artifact/commons-io/commons-io?smo=true | |
import tr.com.avivasa.mobileapp.base.BasePresenter | |
import java.io.StringReader | |
import java.nio.charset.StandardCharsets | |
val base64String = "someBase64String" | |
val inputStream = Base64InputStream( | |
ReaderInputStream.builder() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.graphics.Typeface | |
import android.text.Annotation | |
import android.text.SpannedString | |
import android.text.style.ForegroundColorSpan | |
import android.text.style.StrikethroughSpan | |
import android.text.style.StyleSpan | |
import android.text.style.UnderlineSpan | |
import androidx.annotation.StringRes | |
import androidx.compose.runtime.Composable | |
import androidx.compose.ui.graphics.Color |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Intent | |
import android.net.Uri | |
import android.os.Handler | |
import android.os.Looper | |
import android.os.ParcelFileDescriptor | |
import androidx.activity.ComponentActivity | |
import androidx.activity.result.ActivityResultLauncher | |
import androidx.activity.result.contract.ActivityResultContracts | |
import timber.log.Timber | |
import java.io.ByteArrayInputStream |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun <T : Any> T.equalsAtLeastOne(arg1: T? = null, arg2: T? = null, arg3: T? = null): Boolean { | |
return this == arg1 || this == arg2 || this == arg3 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlin.contracts.ExperimentalContracts | |
import kotlin.contracts.contract | |
@OptIn(ExperimentalContracts::class) | |
fun allNotNull( | |
arg1: Any?, | |
arg2: Any?, | |
arg3: Any? = Any(), | |
arg4: Any? = Any(), | |
arg5: Any? = Any() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CommandLine { | |
static execute(String command) { | |
command.execute().waitForProcessOutput(System.out, System.err) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object HexToBase64 { | |
fun encode(hex: String): String { | |
return Base64.getUrlEncoder().encodeToString(hex.decodeHex()) | |
} | |
private fun String.decodeHex(): ByteArray { | |
check(length % 2 == 0) { "Must have an even length" } | |
return chunked(2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlinx.serialization.ExperimentalSerializationApi | |
import kotlinx.serialization.KSerializer | |
import kotlinx.serialization.builtins.serializer | |
import kotlinx.serialization.descriptors.SerialDescriptor | |
import kotlinx.serialization.descriptors.buildClassSerialDescriptor | |
import kotlinx.serialization.descriptors.element | |
import kotlinx.serialization.encoding.CompositeDecoder | |
import kotlinx.serialization.encoding.Decoder | |
import kotlinx.serialization.encoding.Encoder | |
import kotlinx.serialization.encoding.decodeStructure |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ext.getChangeLog = { lastCommitsCount = 10 -> | |
return formatGitLog(getGitLogUntilCommitNumber(lastCommitsCount)) | |
} | |
ext.getReleaseChangeLog = { | |
def lastTag = getLastTag() | |
return formatGitLog(getGitLogUntilTag(lastTag)) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val activityManager = (context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager) | |
val memoryInfo = ActivityManager.MemoryInfo() | |
activityManager.getMemoryInfo(memoryInfo) | |
val totalMemory = memoryInfo.totalMem |
NewerOlder