Skip to content

Instantly share code, notes, and snippets.

View est7's full-sized avatar
🕶️
dying

est7 est7

🕶️
dying
View GitHub Profile
package com.androidtool.common.base.event
import android.app.Activity
import android.view.View
import android.view.ViewGroup
import android.widget.RemoteViews
import androidx.fragment.app.Fragment
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
object Job {
fun start() {
}
fun cancel() {
}
}
@est7
est7 / 函数回调函数.kts
Created July 25, 2023 09:44
用来取消某些不好取消的函数回调
object Job {
fun start() {
}
fun cancel() {
}
}
import java.awt.Component
//公司框架结构
abstract class Component(name: String) {
//展示
abstract fun show(depth: Int)
}
//这里可以表示具体公司框架(公司、部门)
class Composite(val name: String) : Component(name) {
import java.util.function.Consumer
abstract class Colleague {
//中介者抽象类
protected var mediator: Mediator? = null
//接受消息
abstract fun receive()
//发送消息
class UserHelper {
fun login() {
println("login")
}
fun logout() {
println("logout")
}
}
@est7
est7 / AdjustingViewPager.kt
Created April 12, 2023 07:56 — forked from aqua30/AdjustingViewPager.kt
Adjusting View Pager which adjusts its height according to the view's height in focus
package com.aqua30.learningproject
import android.content.Context
import android.util.AttributeSet
import android.util.Log
import android.view.View
import android.view.View.MeasureSpec
import androidx.viewpager.widget.ViewPager
class AdjustingViewPager: ViewPager {
```java
import android.content.Context;
import android.database.ContentObserver;
import android.database.Cursor;
import android.graphics.Point;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.provider.MediaStore;
import android.text.TextUtils;
/**
* A mediator to link a fragment container with a BottomNavigationView.
*
* The mediator will synchronize the fragment container's content
* with the selected item when a item of BottomNavigationView is selected.
*/
class FragmentBottomNavigationMediator(
private val fragmentManager: FragmentManager,
@IdRes private val containerViewId: Int,
private val bottomNavigationView: BottomNavigationView,
/*
* MIT License
*
* Copyright (c) 2016 Srijith Narayanan
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is