Please sign in to comment.
Android: Add helper class AfterDirectoryInitializationRunner
- Loading branch information...
Showing with 52 additions and 27 deletions.
|@@ -0,0 +1,50 @@|
|public class AfterDirectoryInitializationRunner|
|private DirectoryStateReceiver directoryStateReceiver;|
|* Executes a Runnable after directory initialization has finished.|
|* If this is called when directory initialization already is done,|
|* the Runnable will be executed immediately. If this is called before|
|* directory initialization is done, the Runnable will be executed|
|* after directory initialization finishes successfully, or never|
|* in case directory initialization doesn't finish successfully.|
|* Calling this function multiple times per object is not supported.|
|public void run(Context context, Runnable runnable)|
|// Wait for directories to get initialized|
|IntentFilter statusIntentFilter = new IntentFilter(|
|directoryStateReceiver = new DirectoryStateReceiver(directoryInitializationState ->|
|if (directoryInitializationState ==|
|directoryStateReceiver = null;|
|// Registers the DirectoryStateReceiver and its intent filters|