mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-01 06:38:29 +02:00
Attach snackbar to visible view
This commit is contained in:
@@ -25,6 +25,7 @@ import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -32,6 +33,7 @@ import java.util.List;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
abstract class ActivityBase extends AppCompatActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
private static String[] restart = new String[]{
|
||||
@@ -100,6 +102,17 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
||||
finish();
|
||||
}
|
||||
|
||||
protected View getVisibleView() {
|
||||
for (Fragment fragment : getSupportFragmentManager().getFragments())
|
||||
if (fragment.getUserVisibleHint()) {
|
||||
Log.i(Helper.TAG, "Visible fragment=" + fragment.getClass().getName());
|
||||
return fragment.getView();
|
||||
}
|
||||
|
||||
Log.i(Helper.TAG, "Visible activity=" + this.getClass().getName());
|
||||
return findViewById(android.R.id.content);
|
||||
}
|
||||
|
||||
private List<IBackPressedListener> backPressedListeners = new ArrayList<>();
|
||||
|
||||
public void addBackPressedListener(IBackPressedListener listener) {
|
||||
|
||||
Reference in New Issue
Block a user