diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-05-07 22:12:56 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-05-07 22:12:56 -0700 |
commit | ce8f467cebc86240422ae8bb555f008e6f237bfa (patch) | |
tree | 16bcda1c635006faf19a6497c3d559aeb157b25f /subsonic-android | |
parent | 18b801bb82c448d73ab6402e8ccce92b77ff652a (diff) | |
download | dsub-ce8f467cebc86240422ae8bb555f008e6f237bfa.tar.gz dsub-ce8f467cebc86240422ae8bb555f008e6f237bfa.tar.bz2 dsub-ce8f467cebc86240422ae8bb555f008e6f237bfa.zip |
Fix orientation change for download fragment and showing controls at the same time
Diffstat (limited to 'subsonic-android')
3 files changed, 272 insertions, 255 deletions
diff --git a/subsonic-android/res/layout-land/download.xml b/subsonic-android/res/layout-land/download.xml index 21096235..a125d77e 100644 --- a/subsonic-android/res/layout-land/download.xml +++ b/subsonic-android/res/layout-land/download.xml @@ -1,128 +1,134 @@ <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/download_layout"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/download_layout_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
- <LinearLayout android:orientation="horizontal"
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/download_layout"
+ android:orientation="vertical"
android:layout_width="fill_parent"
- android:layout_height="0dip"
- android:layout_weight="1">
-
- <github.daneren2005.dsub.util.MyViewFlipper
- android:id="@+id/download_playlist_flipper"
- android:layout_width="0dp"
- android:layout_height="fill_parent"
+ android:layout_height="fill_parent">
+
+ <LinearLayout android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="0dip"
android:layout_weight="1">
- <ImageView
- android:id="@+id/download_album_art_image"
- android:src="@drawable/unknown_album_large"
- android:layout_width="wrap_content"
+ <github.daneren2005.dsub.util.MyViewFlipper
+ android:id="@+id/download_playlist_flipper"
+ android:layout_width="0dp"
+ android:layout_height="fill_parent"
+ android:layout_weight="1">
+
+ <ImageView
+ android:id="@+id/download_album_art_image"
+ android:src="@drawable/unknown_album_large"
+ android:layout_width="wrap_content"
+ android:layout_height="fill_parent"
+ android:layout_weight="1"
+ android:scaleType="fitCenter"/>
+
+ <include layout="@layout/download_playlist"/>
+
+ </github.daneren2005.dsub.util.MyViewFlipper>
+
+ <LinearLayout android:orientation="vertical"
+ android:id="@+id/download_control_layout"
+ android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
- android:scaleType="fitCenter"/>
-
- <include layout="@layout/download_playlist"/>
-
- </github.daneren2005.dsub.util.MyViewFlipper>
-
- <LinearLayout android:orientation="vertical"
- android:id="@+id/download_control_layout"
- android:layout_width="0dp"
- android:layout_height="fill_parent"
- android:layout_weight="1"
- android:background="@android:color/transparent">
-
- <LinearLayout
- android:id="@+id/download_other_controls_layout"
- android:orientation="horizontal"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal">
-
- <ImageButton
- android:id="@+id/download_star"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:background="@null"
- android:src="@android:drawable/star_big_off"/>
- <Button
- android:id="@+id/download_equalizer"
- android:text="EQ"
- android:textStyle="bold"
- android:textSize="22sp"
- android:background="@android:color/transparent"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="3dip"
- android:padding="9dip"
- />
- <Button
- android:id="@+id/download_jukebox"
- android:text="RC"
- android:textStyle="bold"
- android:textSize="22sp"
- android:background="@android:color/transparent"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="3dip"
- android:padding="9dip"
- />
- <Button
- android:id="@+id/download_visualizer"
- android:text="VIS"
- android:textStyle="bold"
- android:textSize="22sp"
- android:background="@android:color/transparent"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="3dip"
- android:padding="9dip"
- />
- </LinearLayout>
-
- <LinearLayout
- android:id="@+id/download_visualizer_view_layout"
- android:layout_width="fill_parent"
- android:layout_height="60dip"
- android:layout_marginLeft="12dip"
- android:layout_marginRight="12dip"
- android:layout_gravity="center_horizontal"/>
-
- <TextView
- android:id="@+id/download_song_title"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_marginLeft="12dip"
- android:layout_marginRight="12dip"
- android:singleLine="true"
- android:ellipsize="end"
- android:gravity="center_horizontal"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="?android:textColorPrimary"/>
-
- <TextView
- android:id="@+id/download_status"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:gravity="center_horizontal"
- android:layout_marginBottom="8dip"
- android:layout_marginLeft="12dip"
- android:layout_marginRight="12dip"
- android:singleLine="true"
- android:ellipsize="end"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?android:textColorSecondary" />
-
- <include layout="@layout/download_media_buttons"/>
-
- <include layout="@layout/download_slider"/>
-
- </LinearLayout>
-
- </LinearLayout>
-</LinearLayout>
+ android:background="@android:color/transparent">
+
+ <LinearLayout
+ android:id="@+id/download_other_controls_layout"
+ android:orientation="horizontal"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal">
+
+ <ImageButton
+ android:id="@+id/download_star"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:background="@null"
+ android:src="@android:drawable/star_big_off"/>
+ <Button
+ android:id="@+id/download_equalizer"
+ android:text="EQ"
+ android:textStyle="bold"
+ android:textSize="22sp"
+ android:background="@android:color/transparent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="3dip"
+ android:padding="9dip"
+ />
+ <Button
+ android:id="@+id/download_jukebox"
+ android:text="RC"
+ android:textStyle="bold"
+ android:textSize="22sp"
+ android:background="@android:color/transparent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="3dip"
+ android:padding="9dip"
+ />
+ <Button
+ android:id="@+id/download_visualizer"
+ android:text="VIS"
+ android:textStyle="bold"
+ android:textSize="22sp"
+ android:background="@android:color/transparent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="3dip"
+ android:padding="9dip"
+ />
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/download_visualizer_view_layout"
+ android:layout_width="fill_parent"
+ android:layout_height="60dip"
+ android:layout_marginLeft="12dip"
+ android:layout_marginRight="12dip"
+ android:layout_gravity="center_horizontal"/>
+
+ <TextView
+ android:id="@+id/download_song_title"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_centerHorizontal="true"
+ android:layout_marginLeft="12dip"
+ android:layout_marginRight="12dip"
+ android:singleLine="true"
+ android:ellipsize="end"
+ android:gravity="center_horizontal"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="?android:textColorPrimary"/>
+
+ <TextView
+ android:id="@+id/download_status"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:layout_marginBottom="8dip"
+ android:layout_marginLeft="12dip"
+ android:layout_marginRight="12dip"
+ android:singleLine="true"
+ android:ellipsize="end"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?android:textColorSecondary" />
+
+ <include layout="@layout/download_media_buttons"/>
+
+ <include layout="@layout/download_slider"/>
+
+ </LinearLayout>
+
+ </LinearLayout>
+ </LinearLayout>
+</FrameLayout>
\ No newline at end of file diff --git a/subsonic-android/res/layout-port/download.xml b/subsonic-android/res/layout-port/download.xml index c7912266..a78bc637 100644 --- a/subsonic-android/res/layout-port/download.xml +++ b/subsonic-android/res/layout-port/download.xml @@ -1,143 +1,148 @@ <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/download_layout"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
-
- <github.daneren2005.dsub.util.MyViewFlipper
- android:id="@+id/download_playlist_flipper"
- android:layout_width="fill_parent"
- android:layout_height="0dip"
- android:layout_weight="1">
-
- <RelativeLayout
- android:id="@+id/download_album_art_layout"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_weight="1"
- android:background="@android:color/transparent">
-
- <RelativeLayout android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_weight="1"
- android:layout_above="@+id/download_song_title">
-
- <ImageView
- android:id="@+id/download_album_art_image"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_alignParentTop="true"
- android:scaleType="centerCrop"/>
-
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/download_overlay_buttons"
- android:orientation="horizontal"
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/download_layout_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/download_layout"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
+
+ <github.daneren2005.dsub.util.MyViewFlipper
+ android:id="@+id/download_playlist_flipper"
+ android:layout_width="fill_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1">
+
+ <RelativeLayout
+ android:id="@+id/download_album_art_layout"
+ android:orientation="vertical"
android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:background="@color/overlayColor"
- android:layout_alignParentBottom="true">
-
- <Button
- android:id="@+id/download_jukebox"
- android:text="RC"
- android:textStyle="bold"
- android:textSize="22sp"
- android:background="@android:color/transparent"
+ android:layout_height="fill_parent"
+ android:layout_weight="1"
+ android:background="@android:color/transparent">
+
+ <RelativeLayout android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_weight="1"
+ android:layout_above="@+id/download_song_title">
+
+ <ImageView
+ android:id="@+id/download_album_art_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="bottom"
- android:paddingTop="4dip"
- android:paddingLeft="14dip"
- android:paddingBottom="4dip"/>
-
- <Button
- android:id="@+id/download_equalizer"
- android:text="EQ"
- android:textStyle="bold"
- android:textSize="22sp"
- android:background="@android:color/transparent"
- android:layout_width="wrap_content"
+ android:layout_centerHorizontal="true"
+ android:layout_alignParentTop="true"
+ android:scaleType="centerCrop"/>
+
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/download_overlay_buttons"
+ android:orientation="horizontal"
+ android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:layout_gravity="bottom"
- android:paddingTop="4dip"
- android:paddingLeft="14dip"
- android:paddingBottom="4dip"/>
-
- <Button
- android:id="@+id/download_visualizer"
- android:text="VIS"
- android:textStyle="bold"
- android:textSize="22sp"
- android:background="@android:color/transparent"
+ android:background="@color/overlayColor"
+ android:layout_alignParentBottom="true">
+
+ <Button
+ android:id="@+id/download_jukebox"
+ android:text="RC"
+ android:textStyle="bold"
+ android:textSize="22sp"
+ android:background="@android:color/transparent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom"
+ android:paddingTop="4dip"
+ android:paddingLeft="14dip"
+ android:paddingBottom="4dip"/>
+
+ <Button
+ android:id="@+id/download_equalizer"
+ android:text="EQ"
+ android:textStyle="bold"
+ android:textSize="22sp"
+ android:background="@android:color/transparent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom"
+ android:paddingTop="4dip"
+ android:paddingLeft="14dip"
+ android:paddingBottom="4dip"/>
+
+ <Button
+ android:id="@+id/download_visualizer"
+ android:text="VIS"
+ android:textStyle="bold"
+ android:textSize="22sp"
+ android:background="@android:color/transparent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom"
+ android:paddingTop="4dip"
+ android:paddingLeft="14dip"
+ android:paddingBottom="4dip"/>
+
+ <ImageButton
+ android:id="@+id/download_star"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@+id/download_jukebox"
+ android:background="@android:color/transparent"
+ android:src="@android:drawable/star_big_off"
+ android:paddingTop="4dip"
+ android:paddingLeft="14dip"
+ android:paddingBottom="4dip"/>
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/download_visualizer_view_layout"
+ android:layout_width="fill_parent"
+ android:layout_height="60dip"
+ android:layout_marginLeft="16dip"
+ android:layout_marginRight="16dip"
+ android:layout_gravity="center_horizontal"
+ android:layout_alignParentBottom="true"/>
+ </RelativeLayout>
+
+ <TextView
+ android:id="@+id/download_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="bottom"
- android:paddingTop="4dip"
- android:paddingLeft="14dip"
- android:paddingBottom="4dip"/>
-
- <ImageButton
- android:id="@+id/download_star"
+ android:layout_alignParentBottom="true"
+ android:layout_centerHorizontal="true"
+ android:layout_marginLeft="16dip"
+ android:layout_marginRight="16dip"
+ android:singleLine="true"
+ android:ellipsize="end"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?android:textColorSecondary"/>
+
+ <TextView
+ android:id="@+id/download_song_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_below="@+id/download_jukebox"
- android:background="@android:color/transparent"
- android:src="@android:drawable/star_big_off"
- android:paddingTop="4dip"
- android:paddingLeft="14dip"
- android:paddingBottom="4dip"/>
- </LinearLayout>
-
- <LinearLayout
- android:id="@+id/download_visualizer_view_layout"
- android:layout_width="fill_parent"
- android:layout_height="60dip"
- android:layout_marginLeft="16dip"
- android:layout_marginRight="16dip"
- android:layout_gravity="center_horizontal"
- android:layout_alignParentBottom="true"/>
+ android:layout_gravity="center_horizontal"
+ android:layout_above="@+id/download_status"
+ android:layout_centerHorizontal="true"
+ android:layout_marginLeft="16dip"
+ android:layout_marginRight="16dip"
+ android:singleLine="true"
+ android:textColor="?android:textColorPrimary"
+ android:textStyle="bold"
+ android:textSize="18sp"
+ android:ellipsize="end"/>
+
</RelativeLayout>
- <TextView
- android:id="@+id/download_status"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- android:layout_centerHorizontal="true"
- android:layout_marginLeft="16dip"
- android:layout_marginRight="16dip"
- android:singleLine="true"
- android:ellipsize="end"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?android:textColorSecondary"/>
-
- <TextView
- android:id="@+id/download_song_title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:layout_above="@+id/download_status"
- android:layout_centerHorizontal="true"
- android:layout_marginLeft="16dip"
- android:layout_marginRight="16dip"
- android:singleLine="true"
- android:textColor="?android:textColorPrimary"
- android:textStyle="bold"
- android:textSize="18sp"
- android:ellipsize="end"/>
-
- </RelativeLayout>
-
- <include layout="@layout/download_playlist"/>
-
- </github.daneren2005.dsub.util.MyViewFlipper>
-
- <include layout="@layout/download_media_buttons"/>
-
- <include layout="@layout/download_slider"/>
-</LinearLayout>
+ <include layout="@layout/download_playlist"/>
+
+ </github.daneren2005.dsub.util.MyViewFlipper>
+
+ <include layout="@layout/download_media_buttons"/>
+ <include layout="@layout/download_slider"/>
+ </LinearLayout>
+</FrameLayout>
diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/DownloadFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/DownloadFragment.java index 52359782..dbedf5b0 100644 --- a/subsonic-android/src/github/daneren2005/dsub/fragments/DownloadFragment.java +++ b/subsonic-android/src/github/daneren2005/dsub/fragments/DownloadFragment.java @@ -89,6 +89,7 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe private Button jukeboxButton;
private View toggleListButton;
private ImageButton starButton;
+ private View mainLayout;
private ScheduledExecutorService executorService;
private DownloadFile currentPlaying;
private long currentRevision;
@@ -113,6 +114,11 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
rootView = inflater.inflate(R.layout.download, container, false);
setTitle(nowPlaying ? "Now Playing" : "Downloading");
+
+ mainLayout = rootView.findViewById(R.id.download_layout);
+ if(!primaryFragment) {
+ mainLayout.setVisibility(View.GONE);
+ }
WindowManager w = context.getWindowManager();
Display d = w.getDefaultDisplay();
@@ -524,7 +530,7 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe args.putString(Constants.INTENT_EXTRA_NAME_TITLE, song.getSong().getTitle());
fragment.setArguments(args);
- replaceFragment(fragment, R.id.download_container);
+ replaceFragment(fragment, R.id.download_layout_container);
return true;
case R.id.menu_remove:
new SilentBackgroundTask<Void>(context) {
@@ -678,9 +684,9 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe super.setPrimaryFragment(primary);
if(rootView != null) {
if(primary) {
- rootView.setVisibility(View.VISIBLE);
+ mainLayout.setVisibility(View.VISIBLE);
} else {
- rootView.setVisibility(View.GONE);
+ mainLayout.setVisibility(View.GONE);
}
}
}
|