This file contains 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.SpannableString | |
import android.text.Spanned | |
import android.text.style.StrikethroughSpan | |
import android.text.style.StyleSpan | |
import android.text.style.UnderlineSpan | |
private val BOLD_REGEX = Regex("\\*([^*]+)\\*") | |
private val ITALIC_REGEX = Regex("_([^_]+)_") | |
private val STRIKE_REGEX = Regex("~([^~]+)~") |
This file contains 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 SwiftUI | |
import AVKit | |
struct ContentView: View { | |
@State var audioPlayer: AVAudioPlayer! | |
@State var progress: CGFloat = 0.0 | |
@State private var playing: Bool = false | |
@State var duration: Double = 0.0 | |
@State var formattedDuration: String = "" | |
@State var formattedProgress: String = "00:00" |
This file contains 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
private const val ERROR_EMPTY_VALUE = "Mask cannot be empty" | |
private const val ERROR_INVALID_CHARACTER = "Mask does not contain specified character" | |
data class Mask( | |
val value: String, | |
val character: Char = value.mostOccurred() | |
) { | |
init { | |
require(value.isNotEmpty()) { ERROR_EMPTY_VALUE } | |
require(value.contains(character)) { ERROR_INVALID_CHARACTER } |
This file contains 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
package com.saber.customstickyheader; | |
import android.graphics.Color; | |
import android.support.annotation.NonNull; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.TextView; |
This file contains 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
function ig_media_preview(base64data) { | |
var jpegtpl = "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEABsaGikdKUEmJkFCLy8vQkc/Pj4/R0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0cBHSkpNCY0PygoP0c/NT9HR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR//AABEIABQAKgMBIgACEQEDEQH/xAGiAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgsQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+gEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoLEQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/AA==", | |
t = atob(base64data), | |
p = t.slice(3).split(""), | |
o = t.substring(0, 3).split("").map(function(e) { | |
return e.charCodeAt(0) | |
}), | |
c = atob(jpegtp |
This file contains 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
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | |
val dialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog | |
dialog.behavior.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() { | |
override fun onStateChanged(bottomSheet: View, newState: Int) { | |
Timber.d("State changed $newState") | |
if (newState == BottomSheetBehavior.STATE_EXPANDED) { | |
Timber.d("State is expanded :D") | |
val shape = createShape(bottomSheet) | |
ViewCompat.setBackground(bottomSheet, shape) | |
} |
This file contains 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
package dev.forcetower.hilt.android.dynamic.processor.internal.dynamicentrypoint | |
import com.google.auto.common.MoreElements | |
import com.squareup.javapoet.ClassName | |
import com.squareup.javapoet.CodeBlock | |
import com.squareup.javapoet.FieldSpec | |
import com.squareup.javapoet.JavaFile | |
import com.squareup.javapoet.MethodSpec | |
import com.squareup.javapoet.ParameterizedTypeName | |
import com.squareup.javapoet.TypeName |
This file contains 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
package dev.forcetower.playtime.auth.hilt; | |
import javax.inject.Singleton; | |
import dagger.Binds; | |
import dagger.Component; | |
import dagger.Module; | |
import dagger.Subcomponent; | |
import dagger.hilt.android.components.ActivityComponent; | |
import dagger.hilt.android.components.ActivityRetainedComponent; |
This file contains 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 NavDestination.buildExplicitly(): IntArray { | |
val hierarchy = ArrayDeque<NavDestination>() | |
var current: NavDestination? = this | |
do { | |
val parent = current!!.parent | |
if (parent == null || parent.startDestination != current.id) { | |
hierarchy.addFirst(current) | |
} | |
current = parent | |
} while (current != null) |
NewerOlder