feat(AlignThreads): init
This commit is contained in:
parent
386a754b98
commit
e9052ca5d9
5 changed files with 51 additions and 0 deletions
1
plugins/AlignThreads/.gitignore
vendored
Normal file
1
plugins/AlignThreads/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/build
|
||||
12
plugins/AlignThreads/build.gradle.kts
Normal file
12
plugins/AlignThreads/build.gradle.kts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
version = "1.0.0"
|
||||
description = "Fixes the alignment of \"Create Thread\" button in message actions"
|
||||
|
||||
aliucord {
|
||||
// Changelog of your plugin
|
||||
changelog.set("""
|
||||
# 1.0.0
|
||||
* Initial release >w<
|
||||
""".trimIndent())
|
||||
|
||||
excludeFromUpdaterJson.set(false)
|
||||
}
|
||||
2
plugins/AlignThreads/src/main/AndroidManifest.xml
Normal file
2
plugins/AlignThreads/src/main/AndroidManifest.xml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="moe.lava.awoocord.alignthreads" />
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package moe.lava.awoocord.alignthreads
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.aliucord.Utils
|
||||
import com.aliucord.annotations.AliucordPlugin
|
||||
import com.aliucord.entities.Plugin
|
||||
import com.aliucord.patcher.after
|
||||
import com.aliucord.patcher.component1
|
||||
import com.aliucord.patcher.component2
|
||||
import com.aliucord.utils.DimenUtils
|
||||
import com.discord.widgets.chat.list.actions.`WidgetChatListActions$binding$2`
|
||||
import com.lytefast.flexinput.R
|
||||
|
||||
@AliucordPlugin(requiresRestart = false)
|
||||
@Suppress("unused")
|
||||
class AlignThreads : Plugin() {
|
||||
override fun start(ctx: Context) {
|
||||
patcher.after<`WidgetChatListActions$binding$2`>("invoke", View::class.java)
|
||||
{ (_, view: View) ->
|
||||
val id = Utils.getResId("dialog_chat_actions_start_thread", "id")
|
||||
val threadTextView = view.findViewById<TextView>(id)
|
||||
val size = DimenUtils.dpToPx(24)
|
||||
val icon = ContextCompat.getDrawable(threadTextView.context, R.e.ic_thread)!!
|
||||
icon.setBounds(0, 0, size, size)
|
||||
threadTextView.setCompoundDrawables(icon, null, null, null)
|
||||
}
|
||||
}
|
||||
|
||||
override fun stop(ctx: Context) {
|
||||
patcher.unpatchAll()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue