diff options
Diffstat (limited to 'src/github')
-rw-r--r-- | src/github/daneren2005/dsub/activity/SubsonicActivity.java | 6 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/fragments/SubsonicFragment.java | 42 |
2 files changed, 30 insertions, 18 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/src/github/daneren2005/dsub/activity/SubsonicActivity.java index 8d0e9c20..de0809db 100644 --- a/src/github/daneren2005/dsub/activity/SubsonicActivity.java +++ b/src/github/daneren2005/dsub/activity/SubsonicActivity.java @@ -88,7 +88,7 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte protected SubsonicFragment currentFragment;
protected View primaryContainer;
protected View secondaryContainer;
- protected boolean tv = true;
+ protected boolean tv = false;
Spinner actionBarSpinner;
ArrayAdapter<CharSequence> spinnerAdapter;
ViewGroup rootView;
@@ -369,6 +369,10 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte try {
currentFragment.setContext(this);
currentFragment.onCreateOptionsMenu(menu, menuInflater);
+
+ if(!isTv()) {
+ menu.setGroupVisible(R.id.tv, false);
+ }
} catch(Exception e) {
Log.w(TAG, "Error on creating options menu", e);
}
diff --git a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java index 1e2d2ad8..8bd01cd6 100644 --- a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java +++ b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java @@ -180,6 +180,9 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR case R.id.menu_exit:
exit();
return true;
+ case R.id.menu_refresh:
+ refresh();
+ return true;
}
return false;
@@ -606,22 +609,27 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR }
protected void setupScrollList(final AbsListView listView) {
- listView.setOnScrollListener(new AbsListView.OnScrollListener() {
- @Override
- public void onScrollStateChanged(AbsListView view, int scrollState) {}
+ if(context.isTv()) {
+ refreshLayout.setEnabled(false);
+ } else {
+ listView.setOnScrollListener(new AbsListView.OnScrollListener() {
+ @Override
+ public void onScrollStateChanged(AbsListView view, int scrollState) {
+ }
- @Override
- public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
- int topRowVerticalPosition = (listView.getChildCount() == 0) ? 0 : listView.getChildAt(0).getTop();
- refreshLayout.setEnabled(topRowVerticalPosition >= 0 && listView.getFirstVisiblePosition() == 0);
- }
- });
+ @Override
+ public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
+ int topRowVerticalPosition = (listView.getChildCount() == 0) ? 0 : listView.getChildAt(0).getTop();
+ refreshLayout.setEnabled(topRowVerticalPosition >= 0 && listView.getFirstVisiblePosition() == 0);
+ }
+ });
- refreshLayout.setColorScheme(
- R.color.holo_blue_light,
- R.color.holo_orange_light,
- R.color.holo_green_light,
- R.color.holo_red_light);
+ refreshLayout.setColorScheme(
+ R.color.holo_blue_light,
+ R.color.holo_orange_light,
+ R.color.holo_green_light,
+ R.color.holo_red_light);
+ }
}
protected void warnIfStorageUnavailable() {
@@ -1598,13 +1606,13 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR public void onClick(DialogInterface dialog, int which) {
final Bookmark oldBookmark = entry.getBookmark();
entry.setBookmark(null);
-
+
new LoadingTask<Void>(context, false) {
@Override
protected Void doInBackground() throws Throwable {
MusicService musicService = MusicServiceFactory.getMusicService(context);
musicService.deleteBookmark(entry, context, null);
-
+
new EntryInstanceUpdater(entry) {
@Override
public void update(Entry found) {
@@ -1627,7 +1635,7 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR @Override
protected void error(Throwable error) {
entry.setBookmark(oldBookmark);
-
+
String msg;
if (error instanceof OfflineException || error instanceof ServerTooOldException) {
msg = getErrorMessage(error);
|