diff options
9 files changed, 68 insertions, 16 deletions
diff --git a/res/layout/abstract_list_fragment.xml b/res/layout/abstract_list_fragment.xml index bfce4792..3923f120 100644 --- a/res/layout/abstract_list_fragment.xml +++ b/res/layout/abstract_list_fragment.xml @@ -20,10 +20,17 @@ android:text="@string/common.empty"
android:visibility="gone" />
- <ListView
- android:id="@+id/fragment_list"
+ <android.support.v4.widget.SwipeRefreshLayout
+ android:id="@+id/refresh_layout"
android:layout_width="fill_parent"
android:layout_height="0dip"
- android:layout_weight="1.0"
- android:fastScrollEnabled="true"/>
+ android:layout_weight="1.0">
+
+ <ListView
+ android:id="@+id/fragment_list"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:fastScrollEnabled="true"/>
+
+ </android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>
diff --git a/res/layout/chat.xml b/res/layout/chat.xml index 9b8f7d17..f2c1c3fd 100644 --- a/res/layout/chat.xml +++ b/res/layout/chat.xml @@ -7,12 +7,18 @@ <include layout="@layout/tab_progress" /> - <ListView - android:id="@+id/chat_entries" + <android.support.v4.widget.SwipeRefreshLayout + android:id="@+id/refresh_layout" android:layout_width="fill_parent" android:layout_height="0dip" - android:layout_weight="1.0" - android:textFilterEnabled="true" /> + android:layout_weight="1.0"> + + <ListView + android:id="@+id/chat_entries" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:textFilterEnabled="true" /> + </android.support.v4.widget.SwipeRefreshLayout> <LinearLayout android:layout_height="4dip" @@ -32,7 +38,7 @@ android:layout_weight="1" android:autoLink="all" android:hint="@string/chat.send_a_message" - android:inputType="textEmailAddress|textMultiLine" + android:inputType="textEmailAddress|textMultiLine" android:linksClickable="true" android:paddingBottom="10dip" android:paddingTop="10dip" /> diff --git a/res/layout/select_album.xml b/res/layout/select_album.xml index 01df495a..55747a18 100644 --- a/res/layout/select_album.xml +++ b/res/layout/select_album.xml @@ -20,12 +20,19 @@ android:layout_height="wrap_content"
android:padding="10dip"/>
- <com.mobeta.android.dslv.DragSortListView
- style="@style/DragDropListView"
- android:id="@+id/select_album_entries"
- android:textFilterEnabled="true"
+ <android.support.v4.widget.SwipeRefreshLayout
+ android:id="@+id/refresh_layout"
android:layout_width="fill_parent"
android:layout_height="0dip"
- android:layout_weight="1.0"
- android:fastScrollEnabled="true"/>
+ android:layout_weight="1.0">
+
+ <com.mobeta.android.dslv.DragSortListView
+ style="@style/DragDropListView"
+ android:id="@+id/select_album_entries"
+ android:textFilterEnabled="true"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:fastScrollEnabled="true"/>
+
+ </android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>
\ No newline at end of file diff --git a/src/github/daneren2005/dsub/fragments/ChatFragment.java b/src/github/daneren2005/dsub/fragments/ChatFragment.java index 0721f995..a44221ee 100644 --- a/src/github/daneren2005/dsub/fragments/ChatFragment.java +++ b/src/github/daneren2005/dsub/fragments/ChatFragment.java @@ -9,6 +9,7 @@ import java.util.Collections; import java.util.List;
import android.os.Bundle;
import android.os.Handler;
+import android.support.v4.widget.SwipeRefreshLayout;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
@@ -127,6 +128,9 @@ public class ChatFragment extends SubsonicFragment { }
setTitle(R.string.button_bar_chat);
+ refreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.refresh_layout);
+ refreshLayout.setOnRefreshListener(this);
+
return rootView;
}
@@ -213,6 +217,7 @@ public class ChatFragment extends SubsonicFragment { ChatAdapter chatAdapter = new ChatAdapter(context, messageList);
chatListView.setAdapter(chatAdapter);
}
+ refreshLayout.setRefreshing(false);
}
};
diff --git a/src/github/daneren2005/dsub/fragments/SearchFragment.java b/src/github/daneren2005/dsub/fragments/SearchFragment.java index bd92c1bf..888a5496 100644 --- a/src/github/daneren2005/dsub/fragments/SearchFragment.java +++ b/src/github/daneren2005/dsub/fragments/SearchFragment.java @@ -6,6 +6,7 @@ import java.util.Arrays; import android.content.Intent;
import android.os.Bundle;
+import android.support.v4.widget.SwipeRefreshLayout;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -128,6 +129,9 @@ public class SearchFragment extends SubsonicFragment { populateList();
}
+ refreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.refresh_layout);
+ refreshLayout.setEnabled(false);
+
return rootView;
}
diff --git a/src/github/daneren2005/dsub/fragments/SelectArtistFragment.java b/src/github/daneren2005/dsub/fragments/SelectArtistFragment.java index d10a9c1b..29c6c981 100644 --- a/src/github/daneren2005/dsub/fragments/SelectArtistFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectArtistFragment.java @@ -2,6 +2,7 @@ package github.daneren2005.dsub.fragments; import android.os.Build;
import android.os.Bundle;
+import android.support.v4.widget.SwipeRefreshLayout;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -89,6 +90,9 @@ public class SelectArtistFragment extends SubsonicFragment implements AdapterVie setMusicFolders();
}
+ refreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.refresh_layout);
+ refreshLayout.setOnRefreshListener(this);
+
return rootView;
}
@@ -215,6 +219,7 @@ public class SelectArtistFragment extends SubsonicFragment implements AdapterVie setMusicFolders();
artistList.setVisibility(View.VISIBLE);
+ refreshLayout.setRefreshing(false);
}
};
task.execute();
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java index 5e3281a4..ba2aad1a 100644 --- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java @@ -6,6 +6,7 @@ import android.content.Intent; import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
+import android.support.v4.widget.SwipeRefreshLayout;
import android.util.Log;
import android.view.ContextMenu;
import android.view.LayoutInflater;
@@ -158,6 +159,9 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter setTitle(name);
}
+ refreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.refresh_layout);
+ refreshLayout.setOnRefreshListener(this);
+
return rootView;
}
@@ -602,6 +606,8 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter if (playAll && !restoredInstance) {
playAll(args.getBoolean(Constants.INTENT_EXTRA_NAME_SHUFFLE, false), false);
}
+
+ refreshLayout.setRefreshing(false);
}
private void playNow(final boolean shuffle, final boolean append) {
diff --git a/src/github/daneren2005/dsub/fragments/SelectListFragment.java b/src/github/daneren2005/dsub/fragments/SelectListFragment.java index 5e96ced5..a568d65b 100644 --- a/src/github/daneren2005/dsub/fragments/SelectListFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectListFragment.java @@ -19,6 +19,7 @@ package github.daneren2005.dsub.fragments;
import android.os.Bundle;
+import android.support.v4.widget.SwipeRefreshLayout;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -86,6 +87,9 @@ public abstract class SelectListFragment<T> extends SubsonicFragment implements listView.setAdapter(adapter = getAdapter(objects));
}
+ refreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.refresh_layout);
+ refreshLayout.setOnRefreshListener(this);
+
return rootView;
}
@@ -134,6 +138,7 @@ public abstract class SelectListFragment<T> extends SubsonicFragment implements listView.setAdapter(adapter = getAdapter(result));
listView.setVisibility(View.VISIBLE);
}
+ refreshLayout.setRefreshing(false);
}
};
task.execute();
diff --git a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java index bd0a3f45..a8539723 100644 --- a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java +++ b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java @@ -30,6 +30,7 @@ import android.media.MediaMetadataRetriever; import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
+import android.support.v4.widget.SwipeRefreshLayout;
import android.util.Log;
import android.view.ContextMenu;
import android.view.GestureDetector;
@@ -75,7 +76,7 @@ import java.util.LinkedList; import java.util.List;
import java.util.Random;
-public class SubsonicFragment extends Fragment {
+public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener {
private static final String TAG = SubsonicFragment.class.getSimpleName();
private static int TAG_INC = 10;
private int tag;
@@ -92,6 +93,7 @@ public class SubsonicFragment extends Fragment { protected Share share;
protected boolean artist = false;
protected boolean artistOverride = false;
+ protected SwipeRefreshLayout refreshLayout;
public SubsonicFragment() {
super();
@@ -406,6 +408,11 @@ public class SubsonicFragment extends Fragment { }
+ @Override
+ public void onRefresh() {
+ refresh();
+ }
+
protected void exit() {
if(context.getClass() != SubsonicFragmentActivity.class) {
Intent intent = new Intent(context, SubsonicFragmentActivity.class);
|