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

Commit ec37c885 authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Adding a method called when detecting content change.

Added Loader.onContentChanged()  which is called by ForceLoadContentObserver
when it detects a change, rather than forceLoad().

By default onContentChanged() just calls forceLoad(), so there's no change
in behavior.

This is useful when a subclass wants to perform custom operations upon
data chantes.  For example, a subclass may want to limit the number
of automatic requeries per second.

Change-Id: I493dac3f4f1a75b056d2c7065336ea9252dbf424
parent 100e1065
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -49195,6 +49195,17 @@
 visibility="public"
>
</method>
<method name="onContentChanged"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="registerListener"
 return="void"
 abstract="false"
+14 −4
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ public abstract class Loader<D> {

        @Override
        public void onChange(boolean selfChange) {
            forceLoad();
            onContentChanged();
        }
    }

@@ -151,4 +151,14 @@ public abstract class Loader<D> {
     * Must be called from the UI thread
     */
    public abstract void destroy();

    /**
     * Called when {@link ForceLoadContentObserver} detects a change.  Calls {@link #forceLoad()}
     * by default.
     *
     * Must be called from the UI thread
     */
    public void onContentChanged() {
        forceLoad();
    }
}
 No newline at end of file