mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 00:59:49 +01:00
Allow pending member invite cancelation.
This commit is contained in:
committed by
Greyson Parrelli
parent
1d63970a25
commit
68d29d9a0f
@@ -0,0 +1,19 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public abstract class LifecycleRecyclerAdapter<VH extends LifecycleViewHolder> extends RecyclerView.Adapter<VH> {
|
||||
|
||||
@Override
|
||||
public void onViewAttachedToWindow(@NonNull VH holder) {
|
||||
super.onViewAttachedToWindow(holder);
|
||||
holder.onAttachedToWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewDetachedFromWindow(@NonNull VH holder) {
|
||||
super.onViewDetachedFromWindow(holder);
|
||||
holder.onDetachedFromWindow();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.lifecycle.LifecycleRegistry;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public abstract class LifecycleViewHolder extends RecyclerView.ViewHolder implements LifecycleOwner {
|
||||
|
||||
private final LifecycleRegistry lifecycleRegistry;
|
||||
|
||||
public LifecycleViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
|
||||
lifecycleRegistry = new LifecycleRegistry(this);
|
||||
}
|
||||
|
||||
void onAttachedToWindow() {
|
||||
lifecycleRegistry.setCurrentState(Lifecycle.State.RESUMED);
|
||||
}
|
||||
|
||||
void onDetachedFromWindow() {
|
||||
lifecycleRegistry.setCurrentState(Lifecycle.State.DESTROYED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Lifecycle getLifecycle() {
|
||||
return lifecycleRegistry;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user