diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2020-02-23 20:06:57 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2020-02-25 09:53:00 +0530 |
commit | eb5bfa9b5dde2a4dfb66daae32deab11d12ea11f (patch) | |
tree | 5cf7852428fc9bf56d68fef5126df17016e02eb6 /app/src/main/java/com/wireguard/android | |
parent | 4267e94dcd4e2fd31fcb1d8deaf1735dc13f6b8d (diff) |
Cleanup inset dispatch code
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app/src/main/java/com/wireguard/android')
-rw-r--r-- | app/src/main/java/com/wireguard/android/activity/MainActivity.java | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/app/src/main/java/com/wireguard/android/activity/MainActivity.java b/app/src/main/java/com/wireguard/android/activity/MainActivity.java index 5bc563e6..c19be608 100644 --- a/app/src/main/java/com/wireguard/android/activity/MainActivity.java +++ b/app/src/main/java/com/wireguard/android/activity/MainActivity.java @@ -28,7 +28,6 @@ import com.wireguard.android.fragment.TunnelEditorFragment; import com.wireguard.android.model.Tunnel; import java.util.List; -import java.util.Objects; /** * CRUD interface for WireGuard tunnels. This activity serves as the main entry point to the @@ -79,11 +78,11 @@ public class MainActivity extends BaseActivity onBackStackChanged(); // Dispatch insets on back stack change // This is required to ensure replaced fragments are also able to consume insets - ((ViewGroup) findViewById(android.R.id.content)).setOnApplyWindowInsetsListener((OnApplyWindowInsetsListener) (v, insets) -> { + findViewById(R.id.master_detail_wrapper).setOnApplyWindowInsetsListener((OnApplyWindowInsetsListener) (v, insets) -> { final FragmentManager fragmentManager = getSupportFragmentManager(); fragmentManager.addOnBackStackChangedListener(() -> { final List<Fragment> fragments = fragmentManager.getFragments(); - Objects.requireNonNull(fragments.get(fragments.size() - 1).getView()).dispatchApplyWindowInsets(insets); + fragments.get(fragments.size() - 1).requireView().dispatchApplyWindowInsets(insets); }); return insets; }); |