aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-03-15 18:33:21 -0700
committerScott Jackson <daneren2005@gmail.com>2013-03-15 18:33:21 -0700
commitbfef1d147657ce579ef52841201719b62f68c406 (patch)
tree95839e8b73ada29c1652193c6e340e1ad93d44c8 /subsonic-android
parent0e67d318aec1857c492a19189c5c75411cc3bab7 (diff)
downloaddsub-bfef1d147657ce579ef52841201719b62f68c406.tar.gz
dsub-bfef1d147657ce579ef52841201719b62f68c406.tar.bz2
dsub-bfef1d147657ce579ef52841201719b62f68c406.zip
Added clicking to get to directory fragment from home/playlist
Diffstat (limited to 'subsonic-android')
-rw-r--r--subsonic-android/res/layout/home.xml40
-rw-r--r--subsonic-android/res/layout/select_playlist.xml44
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/fragments/MainFragment.java27
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java18
4 files changed, 76 insertions, 53 deletions
diff --git a/subsonic-android/res/layout/home.xml b/subsonic-android/res/layout/home.xml
index 56b013fe..7f5d1255 100644
--- a/subsonic-android/res/layout/home.xml
+++ b/subsonic-android/res/layout/home.xml
@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
+ android:id="@+id/home_layout"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
- <View
- android:layout_width="fill_parent"
- android:layout_height="1px"
- android:background="@color/dividerColor"/>
+ <View
+ android:layout_width="fill_parent"
+ android:layout_height="1px"
+ android:background="@color/dividerColor"/>
- <ListView
- android:id="@+id/main_list"
- android:layout_width="fill_parent"
- android:layout_height="0px"
- android:layout_weight="1"/>
+ <ListView
+ android:id="@+id/main_list"
+ android:layout_width="fill_parent"
+ android:layout_height="0px"
+ android:layout_weight="1"/>
- <View android:id="@+id/main_dummy"
- android:layout_width="0px"
- android:layout_height="0px"/>
-
- <include
- layout="@layout/button_bar"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"/>
+ <View android:id="@+id/main_dummy"
+ android:layout_width="0px"
+ android:layout_height="0px"/>
+ <include
+ layout="@layout/button_bar"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"/>
</LinearLayout>
diff --git a/subsonic-android/res/layout/select_playlist.xml b/subsonic-android/res/layout/select_playlist.xml
index 2555687d..07c818b5 100644
--- a/subsonic-android/res/layout/select_playlist.xml
+++ b/subsonic-android/res/layout/select_playlist.xml
@@ -1,32 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
+ android:id="@+id/select_playlist_layout"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
- <View
- android:layout_width="fill_parent"
- android:layout_height="1px"
- android:background="@color/dividerColor"/>
+ <View
+ android:layout_width="fill_parent"
+ android:layout_height="1px"
+ android:background="@color/dividerColor"/>
- <include layout="@layout/tab_progress"/>
+ <include layout="@layout/tab_progress"/>
- <TextView
- android:id="@+id/select_playlist_empty"
- android:text="@string/select_playlist.empty"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:padding="10dip"
- android:visibility="gone"/>
+ <TextView
+ android:id="@+id/select_playlist_empty"
+ android:text="@string/select_playlist.empty"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:padding="10dip"
+ android:visibility="gone"/>
- <ListView android:id="@+id/select_playlist_list"
- android:layout_width="fill_parent"
- android:layout_height="0dip"
- android:layout_weight="1.0"
- android:fastScrollEnabled="true"
- />
+ <ListView android:id="@+id/select_playlist_list"
+ android:layout_width="fill_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1.0"
+ android:fastScrollEnabled="true"/>
- <include layout="@layout/button_bar"/>
+ <include layout="@layout/button_bar"/>
</LinearLayout>
diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/MainFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/MainFragment.java
index d179c150..6b753a22 100644
--- a/subsonic-android/src/github/daneren2005/dsub/fragments/MainFragment.java
+++ b/subsonic-android/src/github/daneren2005/dsub/fragments/MainFragment.java
@@ -4,6 +4,7 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
+import android.support.v4.app.FragmentTransaction;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.View;
@@ -144,17 +145,17 @@ public class MainFragment extends SubsonicTabFragment {
} else if (view == offlineButton) {
toggleOffline();
} else if (view == albumsNewestButton) {
- // showAlbumList("newest");
+ showAlbumList("newest");
} else if (view == albumsRandomButton) {
- // showAlbumList("random");
+ showAlbumList("random");
} else if (view == albumsHighestButton) {
- // showAlbumList("highest");
+ showAlbumList("highest");
} else if (view == albumsRecentButton) {
- // showAlbumList("recent");
+ showAlbumList("recent");
} else if (view == albumsFrequentButton) {
- // showAlbumList("frequent");
+ showAlbumList("frequent");
} else if (view == albumsStarredButton) {
- // showAlbumList("starred");
+ showAlbumList("starred");
}
}
});
@@ -191,4 +192,18 @@ public class MainFragment extends SubsonicTabFragment {
Util.setOffline(context, !Util.isOffline(context));
refresh();
}
+
+ private void showAlbumList(String type) {
+ SubsonicTabFragment fragment = new SelectDirectoryFragment();
+ Bundle args = new Bundle();
+ args.putString(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TYPE, type);
+ args.putInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, 20);
+ args.putInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_OFFSET, 0);
+ fragment.setArguments(args);
+
+ final FragmentTransaction trans = getFragmentManager().beginTransaction();
+ trans.replace(R.id.home_layout, fragment);
+ trans.addToBackStack(null);
+ trans.commit();
+ }
}
diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java
index eaba77e5..06fc9f66 100644
--- a/subsonic-android/src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java
+++ b/subsonic-android/src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java
@@ -2,6 +2,7 @@ package github.daneren2005.dsub.fragments;
import android.content.Intent;
import android.os.Bundle;
+import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.ContextMenu;
import android.view.LayoutInflater;
@@ -17,6 +18,7 @@ import github.daneren2005.dsub.service.MusicService;
import github.daneren2005.dsub.service.MusicServiceFactory;
import github.daneren2005.dsub.util.BackgroundTask;
import github.daneren2005.dsub.util.CacheCleaner;
+import github.daneren2005.dsub.util.Constants;
import github.daneren2005.dsub.util.TabBackgroundTask;
import github.daneren2005.dsub.util.Util;
import github.daneren2005.dsub.view.PlaylistAdapter;
@@ -106,11 +108,17 @@ public class SelectPlaylistFragment extends SubsonicTabFragment implements Adapt
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Playlist playlist = (Playlist) parent.getItemAtPosition(position);
-
- /*Intent intent = new Intent(SelectPlaylistActivity.this, SelectAlbumActivity.class);
- intent.putExtra(Constants.INTENT_EXTRA_NAME_PLAYLIST_ID, playlist.getId());
- intent.putExtra(Constants.INTENT_EXTRA_NAME_PLAYLIST_NAME, playlist.getName());
- Util.startActivityWithoutTransition(SelectPlaylistActivity.this, intent);*/
+
+ SubsonicTabFragment fragment = new SelectDirectoryFragment();
+ Bundle args = new Bundle();
+ args.putString(Constants.INTENT_EXTRA_NAME_PLAYLIST_ID, playlist.getId());
+ args.putString(Constants.INTENT_EXTRA_NAME_PLAYLIST_NAME, playlist.getName());
+ fragment.setArguments(args);
+
+ final FragmentTransaction trans = getFragmentManager().beginTransaction();
+ trans.replace(R.id.select_playlist_layout, fragment);
+ trans.addToBackStack(null);
+ trans.commit();
}
@Override