Skip to content

Instantly share code, notes, and snippets.

View ademar111190's full-sized avatar
Lightning Networking the Bitcoin

Ademar ademar111190

Lightning Networking the Bitcoin
  • CEO of Bitcoin
  • Itatiba
View GitHub Profile
@ademar111190
ademar111190 / compress.sh
Created August 2, 2020 14:48
Compress all files using 7z and awk
find . -name "*.psd" | awk '{system("7z a " $0 ".7z " $0)}'
bind -n C-h run "(tmux display-message -p '#{pane_title}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_title}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_title}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_title}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
@ademar111190
ademar111190 / .gitignore
Last active October 20, 2019 14:52
generate random team to complete brasfoot leagues
generated
dict.json
.DS_Store
teams
.idea
@ademar111190
ademar111190 / .zshrc
Last active February 3, 2020 20:58
A .zshrc file
export ZSH="/Users/ademar/.oh-my-zsh"
ZSH_THEME="agnoster"
plugins=(
git
osx
gradle
adb
zsh-autosuggestions
@ademar111190
ademar111190 / BottomNavigationViewIndicator.kt
Created June 17, 2019 18:36
Set 11, playing with customization
...
private fun startUpdateRectAnimation(rect: Rect) {
val toLeft = rect.left < this.rect.left;
animator?.cancel()
animator = AnimatorSet().also {
it.playTogether(
ofInt(this, "rectLeft", this.rect.left, rect.left).apply {
interpolator = if (toLeft) OvershootInterpolator() else LinearOutSlowInInterpolator()
},
ofInt(this, "rectRight", this.rect.right, rect.right).apply {
@ademar111190
ademar111190 / BottomNavigationViewIndicator.kt
Created June 17, 2019 17:33
Step 10, the rect update creator
...
private var index = 0
...
override fun onAttachedToWindow() {
...
child.addOnNavigationItemSelectedListener { updateRectByIndex(it, true) }
post { updateRectByIndex(index, false) }
}
...
private fun updateRectByIndex(index: Int, animated: Boolean) {
@ademar111190
ademar111190 / BottomNavigationViewIndicator.kt
Created June 17, 2019 17:13
Step 9, the animation manager
...
import android.animation.AnimatorSet
import android.animation.ObjectAnimator.ofInt
import androidx.interpolator.view.animation.FastOutSlowInInterpolator
...
private var animator: AnimatorSet? = null
...
private fun startUpdateRectAnimation(rect: Rect) {
animator?.cancel()
animator = AnimatorSet().also {
@ademar111190
ademar111190 / BottomNavigationViewIndicator.kt
Created June 17, 2019 17:04
Step 8, the animator target methods
...
@Keep fun setRectLeft(left: Int) = updateRect(rect.apply { this.left = left })
@Keep fun setRectRight(right: Int) = updateRect(rect.apply { this.right = right })
@Keep fun setRectTop(top: Int) = updateRect(rect.apply { this.top = top })
@Keep fun setRectBottom(bottom: Int) = updateRect(rect.apply { this.bottom = bottom })
...
...
private var rect = Rect()
...
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
canvas.clipRect(rect)
backgroundDrawable.draw(canvas)
}
private fun updateRect(rect: Rect) {
@ademar111190
ademar111190 / BottomNavigationViewIndicator.kt
Created June 12, 2019 21:57
Step 7, the lifecycle evets
...
import android.os.Build.VERSION.SDK_INT
import android.os.Build.VERSION_CODES.LOLLIPOP
import com.google.android.material.bottomnavigation.BottomNavigationMenuView
...
private var target: BottomNavigationMenuView? = null
...
override fun onAttachedToWindow() {
super.onAttachedToWindow()
if (targetId == NO_ID) return attachedError("invalid target id $targetId, did you set the app:targetBottomNavigation attribute?")