Utils

object Utils

Utility class that holds miscellaneous Utilities

Functions

Link copied to clipboard
fun buildClyde(name: String?, avatarUrl: String?): User

Builds Clyde User

Link copied to clipboard
fun createCheckedSetting(context: Context, type: CheckedSetting.ViewType, text: CharSequence?, subtext: CharSequence?): CheckedSetting

Creates a checkable View.

Link copied to clipboard
fun createCommandChoice(name: String, value: String): CommandChoice

Creates a CommandChoice that can be used inside Command args

Link copied to clipboard
fun createCommandOption(type: ApplicationCommandType = ApplicationCommandType.STRING, name: String, description: String? = null, descriptionRes: Int? = null, required: Boolean = false, default: Boolean = false, channelTypes: List<Int?> = emptyList(), choices: List<CommandChoice> = emptyList(), subCommandOptions: List<ApplicationCommandOption> = emptyList(), autocomplete: Boolean = false): ApplicationCommandOption
fun createCommandOption(type: ApplicationCommandType = ApplicationCommandType.STRING, name: String, description: String? = null, descriptionRes: Int? = null, required: Boolean = false, default: Boolean = false, channelTypes: List<Int?> = emptyList(), choices: List<CommandChoice> = emptyList(), subCommandOptions: List<ApplicationCommandOption> = emptyList(), autocomplete: Boolean = false, minValue: Number? = null, maxValue: Number? = null): ApplicationCommandOption

Creates a CommandOption that can be used for commands

Link copied to clipboard

Get a drawable by attribute

Link copied to clipboard
fun getResId(name: String, type: String): Int

Get resource id from discord package.

Link copied to clipboard

Prompt to join the Aliucord support server

Link copied to clipboard

Launches the file explorer in the specified folder. May not work on all Roms, will show an error with advice in that case.

Link copied to clipboard

Launches an URL in the user's preferred Browser

Link copied to clipboard
fun log(msg: String)

Logs a message on debug level.

Link copied to clipboard
fun <R> nestedChildAt(root: ViewGroup, vararg indices: Int): R

Nested childAt. Used to turn nightmares like

Link copied to clipboard
fun openMediaViewer(url: String, filename: String)
Link copied to clipboard
fun openPage(context: Context, clazz: Class<out AppComponent>)
fun openPage(context: Context, clazz: Class<out AppComponent>, intent: Intent?)
Link copied to clipboard
fun openPageWithProxy(context: Context, fragment: Fragment)
Link copied to clipboard
fun pluralise(amount: Int, noun: String): String

Converts the singular term of the noun into plural.

Link copied to clipboard
fun promptRestart(msg: String = "Restart required. Restart now?", position: Int = Gravity.TOP)

Prompts the user to restart Aliucord

Link copied to clipboard

Sets the clipboard content

Link copied to clipboard
fun showToast(message: String, showLonger: Boolean = false)
fun showToast(ctx: Context, message: String, showLonger: Boolean = false)

Send a toast from any Thread

Link copied to clipboard

Tints a Drawable to match the user's current theme. More specifically, tints the drawable to R.c.primary_light_600 if the user is using light theme, R.c.primary_dark_300 otherwise

Properties

Link copied to clipboard
lateinit var appActivity: AppActivity
Link copied to clipboard
Link copied to clipboard

Whether Aliucord is debuggable

Link copied to clipboard

The main (UI) thread

Link copied to clipboard

ThreadPool. Please use this for asynchronous Tasks instead of creating Threads manually as spinning up new Threads everytime is heavy on the CPU

Link copied to clipboard
var widgetChatList: WidgetChatList?

Instance of WidgetChatList. Use this instead of patching it's constructor and storing it.