OSDN Git Service

fixes
authorKoushik Dutta <koushd@gmail.com>
Fri, 1 Mar 2013 08:19:06 +0000 (00:19 -0800)
committerKoushik Dutta <koushd@gmail.com>
Fri, 1 Mar 2013 08:19:06 +0000 (00:19 -0800)
Change-Id: Iae050603f59801ee3678c254aa985857d0c84173

Widgets/src/com/koushikdutta/widgets/FragmentInterfaceWrapper.java
Widgets/src/com/koushikdutta/widgets/ListContentFragmentInternal.java
Widgets/src/com/koushikdutta/widgets/SupportFragment.java

index f3fbb33..8037602 100644 (file)
@@ -12,4 +12,6 @@ public interface FragmentInterfaceWrapper {
     void setArguments(Bundle bundle);
     Bundle getArguments();
     View getView();
+    
+    int getId();
 }
index 529c95d..7ff1655 100644 (file)
@@ -154,14 +154,34 @@ public class ListContentFragmentInternal extends BetterListFragmentInternal {
                 Assert.assertNotNull(l);
                 l.setVisibility(View.GONE);
                 fm.addOnBackStackChangedListener(new OnBackStackChangedListener() {
+                    {
+                        listener = this;
+                    }
                     @Override
                     public void onBackStackChanged() {
-                        if (curSize != fm.getBackStackEntryCount())
+                        Fragment f = (Fragment)getFragment();
+                        if (f.isDetached() || f.isRemoving()) {
+                            fm.removeOnBackStackChangedListener(this);
                             return;
-                        l.setVisibility(View.VISIBLE);
-                        fm.removeOnBackStackChangedListener(this);
+                        }
+                        View v = getFragment().getView();
+                        if (v == null)
+                            return;
+                        final View l = v.findViewById(R.id.list_fragment);
+                        if (l == null)
+                            return;
+                        if (fm.getBackStackEntryCount() > 0 && "content".equals(fm.getBackStackEntryAt(fm.getBackStackEntryCount() - 1).getName())) {
+                            l.setVisibility(View.GONE);
+                        }
+                        else {
+                            l.setVisibility(View.VISIBLE);
+                        }
                     }
                 });
+
+                fm.popBackStack("content", FragmentManager.POP_BACK_STACK_INCLUSIVE);
+                ft.setBreadCrumbTitle(breadcrumb);
+                ft.setBreadCrumbShortTitle(breadcrumb);
                 ft.addToBackStack("content");
             }
             ft.replace(getContentId(), f, "content");
index 1f31eda..9f13cd1 100644 (file)
@@ -1,5 +1,6 @@
 package com.koushikdutta.widgets;
 
+import android.app.Activity;
 import android.content.res.Configuration;
 import android.os.Bundle;
 import android.support.v4.app.Fragment;
@@ -46,4 +47,16 @@ public abstract class SupportFragment<T extends FragmentInterface> extends Fragm
         
         internal.onCreateOptionsMenu(menu, inflater);
     }
+    
+    @Override
+    public void onDetach() {
+        // TODO Auto-generated method stub
+        super.onDetach();
+    }
+    
+    @Override
+    public void onAttach(Activity activity) {
+        // TODO Auto-generated method stub
+        super.onAttach(activity);
+    }
 }