ripple click listener fix
This commit is contained in:
parent
fa37571a05
commit
ac64a03cca
|
|
@ -47,6 +47,16 @@ public abstract class BaseActivity extends AppCompatActivity
|
|||
private final ArrayList<OnBackPressedListener> onBackPressedListeners = new ArrayList<>();
|
||||
@NonNull
|
||||
private final BaseUiBindable baseUiBindable = new BaseUiBindable();
|
||||
private boolean resumed;
|
||||
|
||||
/**
|
||||
* Returns if activity resumed.
|
||||
*
|
||||
* @return True if resumed.
|
||||
*/
|
||||
public boolean isResumed() {
|
||||
return resumed;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable final Bundle savedInstanceState) {
|
||||
|
|
@ -60,6 +70,18 @@ public abstract class BaseActivity extends AppCompatActivity
|
|||
baseUiBindable.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
resumed = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
resumed = false;
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
baseUiBindable.onStop();
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import android.view.ViewGroup;
|
|||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import ru.touchin.roboswag.components.navigation.activities.BaseActivity;
|
||||
import rx.functions.Action0;
|
||||
|
||||
/**
|
||||
|
|
@ -130,9 +131,12 @@ public final class UiUtils {
|
|||
}
|
||||
|
||||
final Runnable runnable = () -> {
|
||||
if (targetView.getWindowVisibility() == View.VISIBLE) {
|
||||
onClickListener.onClick(targetView);
|
||||
if (targetView.getWindowVisibility() != View.VISIBLE
|
||||
|| !targetView.hasWindowFocus()
|
||||
|| (targetView.getContext() instanceof BaseActivity && !((BaseActivity) targetView.getContext()).isResumed())) {
|
||||
return;
|
||||
}
|
||||
onClickListener.onClick(targetView);
|
||||
};
|
||||
|
||||
targetView.setOnClickListener(v -> {
|
||||
|
|
|
|||
Loading…
Reference in New Issue