mirror of
https://github.com/MinimalBible/MinimalBible.github.io
synced 2024-12-21 22:28:17 -05:00
Maybe code highlighting working now?
This commit is contained in:
parent
bc9fe465bc
commit
86bbdff10d
@ -41,7 +41,7 @@ So, let's get into some actual pseudo-code!
|
|||||||
|
|
||||||
**FetchTask.java**
|
**FetchTask.java**
|
||||||
|
|
||||||
```
|
{% highlight java %}
|
||||||
class FetchTask extends AsyncTask<...> {
|
class FetchTask extends AsyncTask<...> {
|
||||||
private EventBus downloadBus;
|
private EventBus downloadBus;
|
||||||
public FetchTask(EventBus downloadBus) {
|
public FetchTask(EventBus downloadBus) {
|
||||||
@ -54,11 +54,11 @@ class FetchTask extends AsyncTask<...> {
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
{% endhighlight %}
|
||||||
|
|
||||||
**DownloadManager.java**
|
**DownloadManager.java**
|
||||||
|
|
||||||
```
|
{% highlight java %}
|
||||||
class DownloadManager {
|
class DownloadManager {
|
||||||
private EventBus downloadBus;
|
private EventBus downloadBus;
|
||||||
private DownloadManager instance;
|
private DownloadManager instance;
|
||||||
@ -75,11 +75,11 @@ class DownloadManager {
|
|||||||
return this.downloadBus;
|
return this.downloadBus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
{% endhighlight %}
|
||||||
|
|
||||||
**Fragment.java**
|
**Fragment.java**
|
||||||
|
|
||||||
```
|
{% highlight java %}
|
||||||
class Fragment {
|
class Fragment {
|
||||||
public void init() {
|
public void init() {
|
||||||
EventBus downloadBus = DownloadManager.getInstance().getDownloadBus();
|
EventBus downloadBus = DownloadManager.getInstance().getDownloadBus();
|
||||||
@ -102,7 +102,7 @@ class Fragment {
|
|||||||
// Initialize the UI - can safely assume we're on main thread
|
// Initialize the UI - can safely assume we're on main thread
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
{% endhighlight %}
|
||||||
|
|
||||||
So, let's quickly review what's going on - the Fragment gets initialized, and gets the Download manager, so it can get the event bus. Then, since the AsyncTask is started alongside the new `DownloadManager`, we register that we should be notified when done.
|
So, let's quickly review what's going on - the Fragment gets initialized, and gets the Download manager, so it can get the event bus. Then, since the AsyncTask is started alongside the new `DownloadManager`, we register that we should be notified when done.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user