diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-06-24 19:38:39 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-06-24 19:38:39 -0700 |
commit | 4de9c5147d1722f00deb0ae475b8f23464226147 (patch) | |
tree | 005547c5a09b76af83ed16fc59a162aff6237abd /app/src/main | |
parent | 09ba1ad3a2f9e9ad7fd634b2c34d95016dc8315b (diff) | |
download | dsub-4de9c5147d1722f00deb0ae475b8f23464226147.tar.gz dsub-4de9c5147d1722f00deb0ae475b8f23464226147.tar.bz2 dsub-4de9c5147d1722f00deb0ae475b8f23464226147.zip |
Hide NowPlaying bar when starting with nothing playing (can't hide later since layout bug keeps a placeholder there) + close bar after clearing queue
Diffstat (limited to 'app/src/main')
3 files changed, 31 insertions, 23 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java index bdbdd44c..c7661080 100644 --- a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java +++ b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java @@ -36,6 +36,7 @@ import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.MenuItem; import android.view.View; +import android.view.ViewGroup; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; @@ -94,6 +95,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity { private Toolbar nowPlayingToolbar; private ScheduledExecutorService executorService; + private View slideUpFrame; private View bottomBar; private ImageView coverArtView; private TextView trackView; @@ -258,6 +260,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity { }, 200); } + slideUpFrame = findViewById(R.id.slide_up_frame); bottomBar = findViewById(R.id.bottom_bar); mainToolbar = (Toolbar) findViewById(R.id.main_toolbar); nowPlayingToolbar = (Toolbar) findViewById(R.id.now_playing_toolbar); @@ -601,30 +604,33 @@ public class SubsonicFragmentActivity extends SubsonicActivity { } MusicDirectory.Entry song = null; - if(current != null) { - song = current.getSong(); - trackView.setText(song.getTitle()); - artistView.setText(song.getArtist()); - } else { - trackView.setText(R.string.main_title); - artistView.setText(R.string.main_artist); - } + if(current != null || slideUpFrame.getVisibility() != View.GONE) { + slideUpFrame.setVisibility(View.VISIBLE); + if (current != null) { + song = current.getSong(); + trackView.setText(song.getTitle()); + artistView.setText(song.getArtist()); + } else { + trackView.setText(R.string.main_title); + artistView.setText(R.string.main_artist); + } - if(coverArtView != null) { - int height = coverArtView.getHeight(); - if(height <= 0) { - int[] attrs = new int[] {R.attr.actionBarSize}; - TypedArray typedArray = this.obtainStyledAttributes(attrs); - height = typedArray.getDimensionPixelSize(0, 0); - typedArray.recycle(); + if (coverArtView != null) { + int height = coverArtView.getHeight(); + if (height <= 0) { + int[] attrs = new int[]{R.attr.actionBarSize}; + TypedArray typedArray = this.obtainStyledAttributes(attrs); + height = typedArray.getDimensionPixelSize(0, 0); + typedArray.recycle(); + } + getImageLoader().loadImage(coverArtView, song, false, height, false); } - getImageLoader().loadImage(coverArtView, song, false, height, false); - } - int[] attrs = new int[] {(state == PlayerState.STARTED) ? R.attr.actionbar_pause : R.attr.actionbar_start}; - TypedArray typedArray = this.obtainStyledAttributes(attrs); - startButton.setImageResource(typedArray.getResourceId(0, 0)); - typedArray.recycle(); + int[] attrs = new int[]{(state == PlayerState.STARTED) ? R.attr.actionbar_pause : R.attr.actionbar_start}; + TypedArray typedArray = this.obtainStyledAttributes(attrs); + startButton.setImageResource(typedArray.getResourceId(0, 0)); + typedArray.recycle(); + } } public void checkUpdates() { diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java index 151a66ca..0f9d9f68 100644 --- a/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java +++ b/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java @@ -738,7 +738,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis @Override protected void done(Void result) { - onDownloadListChanged(); + context.closeNowPlaying(); } }.execute(); } diff --git a/app/src/main/res/layout/abstract_fragment_activity.xml b/app/src/main/res/layout/abstract_fragment_activity.xml index bf8d9640..44ac35fd 100644 --- a/app/src/main/res/layout/abstract_fragment_activity.xml +++ b/app/src/main/res/layout/abstract_fragment_activity.xml @@ -27,9 +27,11 @@ </FrameLayout> <LinearLayout + android:id="@+id/slide_up_frame" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical"> + android:orientation="vertical" + android:visibility="gone"> <FrameLayout android:id="@+id/slide_up_swipe_target" |