From 3fe3f64fa89c0d33b4fcbc37658e175df535b146 Mon Sep 17 00:00:00 2001 From: Bradlee Speice Date: Sat, 2 Aug 2014 22:25:53 -0400 Subject: [PATCH] And fix a formatting issue --- _posts/2014-07-22-the-ogholder-pattern.md | 46 +++++++++++------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/_posts/2014-07-22-the-ogholder-pattern.md b/_posts/2014-07-22-the-ogholder-pattern.md index 3901ffe..fa83fd2 100644 --- a/_posts/2014-07-22-the-ogholder-pattern.md +++ b/_posts/2014-07-22-the-ogholder-pattern.md @@ -129,34 +129,34 @@ To demonstrate the principle, we need to add only a single class: **OGHolder.java** {% highlight java %} public class OGHolder extends Fragment { - private final static String TAG = "OGHolder"; - private ObjectGraph mObjectGraph; + private final static String TAG = "OGHolder"; + private ObjectGraph mObjectGraph; // Use FragmentActivity for the support library - public static OGHolder get(Activity activity) { // 1 - // Use getSupportFragmentManager for support library - FragmentManager manager = activity.getFragmentManager(); - OGHolder holder = (OGHolder) manager.findFragmentByTag(TAG); // 2 - if (holder == null) { - holder = new OGHolder(); - manager.beginTransaction().add(holder, TAG).commit(); - } - return holder; - } + public static OGHolder get(Activity activity) { // 1 + // Use getSupportFragmentManager for support library + FragmentManager manager = activity.getFragmentManager(); + OGHolder holder = (OGHolder) manager.findFragmentByTag(TAG); // 2 + if (holder == null) { + holder = new OGHolder(); + manager.beginTransaction().add(holder, TAG).commit(); + } + return holder; + } - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setRetainInstance(true); // 3 - } + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setRetainInstance(true); // 3 + } - public void persistGraph(ObjectGraph graph) { - mObjectGraph = graph; - } + public void persistGraph(ObjectGraph graph) { + mObjectGraph = graph; + } - public ObjectGraph fetchGraph() { - return mObjectGraph; - } + public ObjectGraph fetchGraph() { + return mObjectGraph; + } } {% endhighlight %}