Implemented refreshing playlist when shuffle button is clicked
This commit is contained in:
parent
48689f645d
commit
91e8035eb7
|
@ -16,7 +16,6 @@
|
||||||
package org.xbmc.kore.ui;
|
package org.xbmc.kore.ui;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -29,7 +28,6 @@ import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.GridLayout;
|
import android.widget.GridLayout;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
@ -41,7 +39,6 @@ import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.xbmc.kore.R;
|
import org.xbmc.kore.R;
|
||||||
import org.xbmc.kore.Settings;
|
|
||||||
import org.xbmc.kore.host.HostConnectionObserver;
|
import org.xbmc.kore.host.HostConnectionObserver;
|
||||||
import org.xbmc.kore.host.HostInfo;
|
import org.xbmc.kore.host.HostInfo;
|
||||||
import org.xbmc.kore.host.HostManager;
|
import org.xbmc.kore.host.HostManager;
|
||||||
|
@ -83,6 +80,7 @@ public class NowPlayingFragment extends Fragment
|
||||||
*/
|
*/
|
||||||
public interface NowPlayingListener {
|
public interface NowPlayingListener {
|
||||||
public void SwitchToRemotePanel();
|
public void SwitchToRemotePanel();
|
||||||
|
public void onShuffleClicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -341,6 +339,7 @@ public class NowPlayingFragment extends Fragment
|
||||||
if (!isAdded()) return;
|
if (!isAdded()) return;
|
||||||
// Force a refresh
|
// Force a refresh
|
||||||
hostConnectionObserver.forceRefreshResults();
|
hostConnectionObserver.forceRefreshResults();
|
||||||
|
nowPlayingListener.onShuffleClicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -80,6 +80,11 @@ public class RemoteActivity extends BaseActivity
|
||||||
SendTextDialogFragment.SendTextDialogListener {
|
SendTextDialogFragment.SendTextDialogListener {
|
||||||
private static final String TAG = LogUtils.makeLogTag(RemoteActivity.class);
|
private static final String TAG = LogUtils.makeLogTag(RemoteActivity.class);
|
||||||
|
|
||||||
|
|
||||||
|
private static final int NOWPLAYING_FRAGMENT_ID = 1;
|
||||||
|
private static final int REMOTE_FRAGMENT_ID = 2;
|
||||||
|
private static final int PLAYLIST_FRAGMENT_ID = 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Host manager singleton
|
* Host manager singleton
|
||||||
*/
|
*/
|
||||||
|
@ -125,9 +130,9 @@ public class RemoteActivity extends BaseActivity
|
||||||
|
|
||||||
// Set up pager and fragments
|
// Set up pager and fragments
|
||||||
TabsAdapter tabsAdapter = new TabsAdapter(this, getSupportFragmentManager())
|
TabsAdapter tabsAdapter = new TabsAdapter(this, getSupportFragmentManager())
|
||||||
.addTab(NowPlayingFragment.class, null, R.string.now_playing, 1)
|
.addTab(NowPlayingFragment.class, null, R.string.now_playing, NOWPLAYING_FRAGMENT_ID)
|
||||||
.addTab(RemoteFragment.class, null, R.string.remote, 2)
|
.addTab(RemoteFragment.class, null, R.string.remote, REMOTE_FRAGMENT_ID)
|
||||||
.addTab(PlaylistFragment.class, null, R.string.playlist, 3);
|
.addTab(PlaylistFragment.class, null, R.string.playlist, PLAYLIST_FRAGMENT_ID);
|
||||||
|
|
||||||
viewPager.setAdapter(tabsAdapter);
|
viewPager.setAdapter(tabsAdapter);
|
||||||
pageIndicator.setViewPager(viewPager);
|
pageIndicator.setViewPager(viewPager);
|
||||||
|
@ -323,7 +328,7 @@ public class RemoteActivity extends BaseActivity
|
||||||
|
|
||||||
|
|
||||||
private void setupActionBar() {
|
private void setupActionBar() {
|
||||||
setToolbarTitle(toolbar, 1);
|
setToolbarTitle(toolbar, NOWPLAYING_FRAGMENT_ID);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
ActionBar actionBar = getSupportActionBar();
|
ActionBar actionBar = getSupportActionBar();
|
||||||
|
@ -472,13 +477,7 @@ public class RemoteActivity extends BaseActivity
|
||||||
}, callbackHandler);
|
}, callbackHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force a refresh of the playlist fragment
|
refreshPlaylist();
|
||||||
String tag = "android:switcher:" + viewPager.getId() + ":" + 3;
|
|
||||||
PlaylistFragment playlistFragment = (PlaylistFragment)getSupportFragmentManager()
|
|
||||||
.findFragmentByTag(tag);
|
|
||||||
if (playlistFragment != null) {
|
|
||||||
playlistFragment.forceRefreshPlaylist();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -670,4 +669,18 @@ public class RemoteActivity extends BaseActivity
|
||||||
public void SwitchToRemotePanel() {
|
public void SwitchToRemotePanel() {
|
||||||
viewPager.setCurrentItem(1);
|
viewPager.setCurrentItem(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShuffleClicked() {
|
||||||
|
refreshPlaylist();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshPlaylist() {
|
||||||
|
String tag = "android:switcher:" + viewPager.getId() + ":" + PLAYLIST_FRAGMENT_ID;
|
||||||
|
PlaylistFragment playlistFragment = (PlaylistFragment)getSupportFragmentManager()
|
||||||
|
.findFragmentByTag(tag);
|
||||||
|
if (playlistFragment != null) {
|
||||||
|
playlistFragment.forceRefreshPlaylist();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue