Fix changing play/pause icons on remote, with different themes
This commit is contained in:
parent
32c937fb51
commit
d8750cc6db
|
@ -27,6 +27,7 @@ import android.support.v4.app.TaskStackBuilder;
|
|||
import org.xbmc.kore.R;
|
||||
import org.xbmc.kore.Settings;
|
||||
import org.xbmc.kore.utils.LogUtils;
|
||||
import org.xbmc.kore.utils.UIUtils;
|
||||
|
||||
/**
|
||||
* Simple fragment to display preferences screen
|
||||
|
@ -69,6 +70,9 @@ public class SettingsFragment extends PreferenceFragment
|
|||
if (key.equals(Settings.KEY_PREF_THEME)) {
|
||||
//String newTheme = sharedPreferences.getString(key, DEFAULT_PREF_THEME);
|
||||
|
||||
// Explicitly clear cache of resource ids that is maintained in the activity
|
||||
UIUtils.playPauseIconsLoaded = false;
|
||||
|
||||
// restart to apply new theme (actually build an entirely new task stack)
|
||||
TaskStackBuilder.create(getActivity())
|
||||
.addNextIntent(new Intent(getActivity(), RemoteActivity.class))
|
||||
|
|
|
@ -198,7 +198,7 @@ public class UIUtils {
|
|||
return new CharacterDrawable(charAvatar, color);
|
||||
}
|
||||
|
||||
static boolean playPauseIconsLoaded = false;
|
||||
public static boolean playPauseIconsLoaded = false;
|
||||
static int iconPauseResId = R.drawable.ic_pause_white_24dp,
|
||||
iconPlayResId = R.drawable.ic_play_arrow_white_24dp;
|
||||
/**
|
||||
|
@ -210,7 +210,7 @@ public class UIUtils {
|
|||
public static void setPlayPauseButtonIcon(Context context, ImageView view, int speed) {
|
||||
|
||||
if (!playPauseIconsLoaded) {
|
||||
TypedArray styledAttributes = context.obtainStyledAttributes(new int[]{iconPauseResId, iconPlayResId});
|
||||
TypedArray styledAttributes = context.obtainStyledAttributes(new int[]{R.attr.iconPause, R.attr.iconPlay});
|
||||
iconPauseResId = styledAttributes.getResourceId(0, R.drawable.ic_pause_white_24dp);
|
||||
iconPlayResId = styledAttributes.getResourceId(1, R.drawable.ic_play_arrow_white_24dp);
|
||||
styledAttributes.recycle();
|
||||
|
|
Loading…
Reference in New Issue