This file contains 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
package com.pplive.archcomponent.jetpack.livedata; | |
import androidx.lifecycle.Lifecycle; | |
import androidx.lifecycle.LifecycleOwner; | |
import androidx.lifecycle.Observer; | |
import android.os.Handler; | |
import android.os.Looper; | |
import androidx.annotation.NonNull; | |
import java.util.HashMap; |
This file contains 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
/* | |
* Copyright (C) 2017 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains 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
/** | |
* 当有很多用户同时登入和登出时, | |
* onUserSignIn() 和 onUserSignOut() 就会有很多线程同时调用 | |
*/ | |
class UserMgr private constructor() { | |
private val userMap: ConcurrentHashMap<String, User> = ConcurrentHashMap<String, User>() | |
companion object { | |
private val instance by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { UserMgr() } |
This file contains 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 PreDelegate<T>( | |
private val name: String, | |
private val default: T, | |
private val isCommit: Boolean = false, | |
private val prefs: SharedPreferences | |
) { | |
operator fun getValue(thisRef: Any?, property: KProperty<*>): T { | |
return getPref(name, default) ?: default | |
} |
This file contains 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
public class LiveDataBus { | |
private static LiveDataBus liveDataBus; | |
//应用中所有数据持有类的集合 | |
private Map<String,MyMutableLiveData<Object>> map; | |
private LiveDataBus(){ | |
map=new HashMap<>(); |
This file contains 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 android.os.Bundle | |
import android.util.Log | |
import android.view.ViewGroup | |
import android.widget.TextView | |
import androidx.appcompat.app.AppCompatActivity | |
import androidx.databinding.DataBindingUtil | |
import androidx.lifecycle.Lifecycle | |
import androidx.lifecycle.LifecycleObserver | |
import androidx.lifecycle.OnLifecycleEvent | |
import app.keima.android.recyclerviewsandbox.databinding.ActivityMainBinding |
This file contains 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 androidx.fragment.app.DialogFragment; | |
import androidx.fragment.app.FragmentManager; | |
import androidx.fragment.app.FragmentTransaction; | |
import org.jetbrains.annotations.NotNull; | |
import java.lang.reflect.Field; | |
/** | |
* Fix `DialogFragment` crash questions ... <br /><br /> | |
* |
This file contains 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
public class BaseRecyclerView extends RecyclerView implements LifecycleObserver { | |
public BaseRecyclerView(@NonNull Context context) { | |
super(context); | |
init(context); | |
} | |
public BaseRecyclerView(@NonNull Context context, @Nullable AttributeSet attrs) { | |
super(context, attrs); | |
init(context); | |
} |
This file contains 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
// | |
// Source code recreated from a .class file by IntelliJ IDEA | |
// (powered by Fernflower decompiler) | |
// | |
package com.longzhu.utils.android; | |
import android.text.TextUtils; | |
import android.util.Log; |
This file contains 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
[Desktop Entry] | |
Name=dwm | |
Comment=Suckless Window Manager | |
Exec=/usr/local/bin/dwm | |
TryExec=/usr/local/bin/dwm | |
Icon=/home/cesc/dwm/dwm.png | |
Type=Application |
NewerOlder