Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c0075dc2 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Use inotify to update DocumentsUI.

While user is actively looking at a directory, subscribe to inotify
events and notify of content changes to trigger requeries.  Reference
count the observers, since multiple cursors are regularly open during
requeries.

Fix leaking cursors on activity rotation; crazy loader ID generation
is no longer needed.

Bug: 10999396
Change-Id: Iddeb08a056fee80c93df8499874705bcd213a1e2
parent 13f7fc80
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -84,7 +84,6 @@ import com.google.android.collect.Lists;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * Display the documents inside a single directory.
@@ -127,9 +126,7 @@ public class DirectoryFragment extends Fragment {
    private static final String EXTRA_QUERY = "query";
    private static final String EXTRA_IGNORE_STATE = "ignoreState";

    private static AtomicInteger sLoaderId = new AtomicInteger(4000);

    private final int mLoaderId = sLoaderId.incrementAndGet();
    private final int mLoaderId = 42;

    public static void showNormal(FragmentManager fm, RootInfo root, DocumentInfo doc, int anim) {
        show(fm, TYPE_NORMAL, root, doc, null, anim);