Android-x86
Fork
Faire un don

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-koush-Widgets: Commit

external/koush/Widgets


Commit MetaInfo

Révisione220b863b498c27e6399d93e9efdf3a001757f14 (tree)
l'heure2013-02-28 08:58:45
AuteurKoushik Dutta <koushd@gmai...>
CommiterKoushik Dutta

Message de Log

convenience functions and fixes

Change Summary

Modification

--- a/Widgets/src/com/koushikdutta/widgets/BetterListFragment.java
+++ b/Widgets/src/com/koushikdutta/widgets/BetterListFragment.java
@@ -1,5 +1,7 @@
11 package com.koushikdutta.widgets;
22
3+import com.koushikdutta.widgets.BetterListFragmentInternal.ListItemAdapter;
4+
35 import android.os.Bundle;
46 import android.view.View;
57
@@ -29,4 +31,68 @@ public class BetterListFragment extends SupportFragment<BetterListFragmentIntern
2931
3032 protected void onCreate(Bundle savedInstanceState, View view) {
3133 }
34+
35+
36+ public void removeSection(int section) {
37+ getInternal().removeSection(section);
38+ }
39+
40+ public void removeSection(String section) {
41+ getInternal().removeSection(section);
42+ }
43+
44+
45+
46+ public ListItemAdapter ensureHeader(int sectionName) {
47+ return getInternal().ensureHeader(sectionName);
48+ }
49+
50+ public ListItemAdapter ensureHeader(String sectionName) {
51+ return getInternal().ensureHeader(sectionName);
52+ }
53+
54+ public ListItemAdapter ensureHeader(int index, int sectionName) {
55+ return getInternal().ensureHeader(sectionName);
56+ }
57+ public ListItemAdapter ensureHeader(int index, String sectionName) {
58+ return getInternal().ensureHeader(index, sectionName);
59+
60+ }
61+
62+ public ListItemAdapter getSection(int section) {
63+ return getInternal().getSection(section);
64+ }
65+
66+ public ListItemAdapter getSection(String section) {
67+ return getInternal().getSection(section);
68+ }
69+
70+ public ListItem addItem(int sectionName, ListItem item) {
71+ return getInternal().addItem(sectionName, item);
72+ }
73+
74+ public ListItem addItem(int sectionName, ListItem item, int index) {
75+ return getInternal().addItem(sectionName, item);
76+ }
77+
78+ public ListItem addItem(String sectionName, ListItem item) {
79+ return getInternal().addItem(sectionName, item);
80+ }
81+
82+ public void clear() {
83+ getInternal().clear();
84+ }
85+
86+ public void clearSection(int section) {
87+ getInternal().clearSection(section);
88+ }
89+
90+ public void clearSection(String section) {
91+ getInternal().clearSection(section);
92+ }
93+
94+ public void removeItem(ListItem item) {
95+ getInternal().removeItem(item);
96+ }
97+
3298 }
--- a/Widgets/src/com/koushikdutta/widgets/FragmentInterfaceWrapper.java
+++ b/Widgets/src/com/koushikdutta/widgets/FragmentInterfaceWrapper.java
@@ -1,9 +1,13 @@
11 package com.koushikdutta.widgets;
22
33 import android.app.Activity;
4+import android.os.Bundle;
45
56 public interface FragmentInterfaceWrapper {
67 public Activity getActivity();
78 public FragmentInterface getInternal();
89 public void setHasOptionsMenu(boolean options);
10+
11+ void setArguments(Bundle bundle);
12+ Bundle getArguments();
913 }
--- a/Widgets/src/com/koushikdutta/widgets/ListContentFragmentInternal.java
+++ b/Widgets/src/com/koushikdutta/widgets/ListContentFragmentInternal.java
@@ -54,15 +54,12 @@ public class ListContentFragmentInternal extends BetterListFragmentInternal {
5454 return mContainer instanceof ViewSwitcher;
5555 }
5656
57- void setContentNative(FragmentInterfaceWrapper last) {
57+ void setContentNative() {
5858 android.app.Fragment f = (android.app.Fragment)mCurrentContent;
5959 Activity fa = getActivity();
6060 android.app.FragmentTransaction ft = fa.getFragmentManager().beginTransaction();
61- if (last != null)
62- ft.replace(R.id.content, f);
63- else
64- ft.add(R.id.content, f);
65- ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
61+ ft.replace(R.id.content, f);
62+ ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
6663 if (mContainer instanceof ViewSwitcher) {
6764 ViewSwitcher switcher = (ViewSwitcher)mContainer;
6865 if (mContent != switcher.getCurrentView())
@@ -72,16 +69,12 @@ public class ListContentFragmentInternal extends BetterListFragmentInternal {
7269 }
7370
7471 public void setContent(FragmentInterfaceWrapper content, boolean clearChoices) {
75- FragmentInterfaceWrapper last = mCurrentContent;
7672 mCurrentContent = content;
7773 if (getActivity() instanceof FragmentActivity) {
7874 Fragment f = (Fragment)mCurrentContent;
7975 FragmentActivity fa = (FragmentActivity)getActivity();
8076 FragmentTransaction ft = fa.getSupportFragmentManager().beginTransaction();
81- if (last != null)
82- ft.replace(R.id.content, f);
83- else
84- ft.add(R.id.content, f);
77+ ft.replace(R.id.content, f);
8578 ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
8679 if (mContainer instanceof ViewSwitcher) {
8780 ViewSwitcher switcher = (ViewSwitcher)mContainer;
@@ -91,7 +84,7 @@ public class ListContentFragmentInternal extends BetterListFragmentInternal {
9184 ft.commit();
9285 }
9386 else {
94- setContentNative(last);
87+ setContentNative();
9588 }
9689
9790 if (clearChoices)
Afficher sur ancien navigateur de dépôt.