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
bool checkCert(JNIEnv *env, jobject contextObject) { | |
jclass contextTemp = env->FindClass("android/content/Context"); | |
jclass contextClass = (jclass) env->NewGlobalRef(contextTemp); | |
jmethodID getPackageManager = env->GetMethodID(contextClass, | |
"getPackageManager", | |
"()Landroid/content/pm/PackageManager;"); | |
jobject share = (jobject) env->CallObjectMethod(contextObject, getPackageManager); | |
jmethodID getPackageName = env->GetMethodID(contextClass, "getPackageName", | |
"()Ljava/lang/String;"); |
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
implementation 'com.adid.adapterdelegate:autonotifyadapterdelegate:1.0.2' |
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 SampleAdapter : RecyclerView.Adapter<SampleViewHolder>() { | |
private var itemList: List<SampleItem> by autoNotifyDelegate(adapter = this, initialValue = listOf()) | |
fun setItems(itemList: List<SampleItem>) { | |
this.itemList = itemList | |
} | |
(...) | |
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
fun <T : List<DiffItem>, R : RecyclerView.ViewHolder> autoNotifyDelegate(adapter: RecyclerView.Adapter<R>, initialValue: T): ReadWriteProperty<Any?, T> = | |
object : ObservableProperty<T>(initialValue) { | |
override fun afterChange(property: KProperty<*>, oldValue: T, newValue: T) { | |
adapter.autoNotify(oldValue, newValue) | |
} | |
} |
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 SampleAdapter : RecyclerView.Adapter<SampleViewHolder>() { | |
private var itemList: List<SampleItem> by Delegates.observable(initialValue = listOf(), onChange = { property, oldValue, newValue -> | |
autoNotify(oldValue, newValue) | |
}) | |
fun setItems(itemList: List<SampleItem>) { | |
this.itemList = itemList | |
} | |
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
fun <T : DiffItem, R : RecyclerView.ViewHolder> RecyclerView.Adapter<R>.autoNotify(oldList: List<T>, newList: List<T>) { | |
val diffItemCallback = object : DiffUtil.Callback() { | |
override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int) = | |
oldList[oldItemPosition].getItemId() == newList[newItemPosition].getItemId() | |
override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int) = | |
oldList[oldItemPosition].getDiff() == newList[newItemPosition].getDiff() |
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 SampleAdapter : RecyclerView.Adapter<SampleViewHolder>() { | |
private var itemList: List<SampleItem> = listOf() | |
fun setItems(newList: List<SampleItem>) { | |
val diffItemCallback = object : DiffUtil.Callback() { | |
override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int) = | |
this.itemList[oldItemPosition].getItemId() == newList[newItemPosition].getItemId() |
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
Hi(key, salt, i): | |
U1 := HMAC(key, salt + INT(1)) | |
U2 := HMAC(key, U1) | |
(...) | |
Ui-1 := HMAC(key, Ui-2) | |
Ui := HMAC(key, Ui-1) | |
Hi := U1 XOR U2 XOR ... XOR Ui |
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
{ | |
"iss": "JRzN/2CWcCI7B1ZZdGKcdnX+5LY", | |
"iat": 1542022860, | |
"exp": 1542023100 | |
} |
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
{ | |
"alg": "HS256", | |
"typ": "JWT" | |
} |
NewerOlder