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
private typealias DialogCallback<T> = T.() -> Unit | |
interface DialogBuilder<T> { | |
fun title(title: String) | |
fun title(titleResId: Int) | |
fun message(message: String) | |
fun message(messageResId: Int) |
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
private class DialogBuilderImpl<T>(val context: Context) : DialogBuilder<T> { | |
data class DialogArgs<T>( | |
val title: String? = null, | |
val message: String? = null, | |
val yesButtonAction: Serializable? = null, | |
val noButtonAction: Serializable? = null, | |
val yesButtonText: String? = null, | |
val noButtonText: String? = null | |
) : Serializable |
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 BetterDialog<T> : DialogFragment() { | |
companion object { | |
val KEY_ARGS = "KEY_ARGS" | |
val KEY_CALLED_FROM_FRAGMENT = "KEY_CALLED_FROM_FRAGMENT" | |
val TAG = "DIALOG_TAG" | |
} | |
@Suppress("UNCHECKED_CAST") | |
private val args: DialogBuilderImpl.DialogArgs<T> by lazy { | |
checkNotNull(arguments?.getSerializable(KEY_ARGS) as DialogBuilderImpl.DialogArgs<T>) { "Args are null!" } |
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 math | |
from collections import deque | |
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
from .separation import SeparationNet | |
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 random | |
import random | |
import sys | |
import time | |
import threading | |
import queue | |
from collections import defaultdict | |
from dataclasses import dataclass | |
from pathlib import Path | |
from typing import Dict, List, Optional, Tuple |
OlderNewer