Merge "Merge changes Ife2ffbed,I3bd8b266 into nyc-dev am: 3a1d9d5f06 am: 6489b522dc" into nyc-mr1-dev-plus-aosp
This commit is contained in:
committed by
Android (Google) Code Review
commit
daba65a3b6
@@ -133,8 +133,10 @@ public abstract class MediaPlayerGlue extends PlaybackControlGlue implements
|
||||
*/
|
||||
public void setupControlsRowPresenter(PlaybackControlsRowPresenter presenter) {
|
||||
// TODO: hahnr@ move into resources
|
||||
presenter.setProgressColor(getContext().getColor(R.color.player_progress_color));
|
||||
presenter.setBackgroundColor(getContext().getColor(R.color.player_background_color));
|
||||
presenter.setProgressColor(getContext().getResources().getColor(
|
||||
R.color.player_progress_color));
|
||||
presenter.setBackgroundColor(getContext().getResources().getColor(
|
||||
R.color.player_background_color));
|
||||
}
|
||||
|
||||
@Override public PlaybackControlsRowPresenter createControlsRowAndPresenter() {
|
||||
@@ -284,13 +286,34 @@ public abstract class MediaPlayerGlue extends PlaybackControlGlue implements
|
||||
}
|
||||
|
||||
/**
|
||||
* @see MediaPlayer#setDataSource(Context, Uri)
|
||||
* Sets the media source of the player witha given URI.
|
||||
* @see MediaPlayer#setDataSource(String)
|
||||
* @return Returns <code>true</code> if uri represents a new media; <code>false</code>
|
||||
* otherwise.
|
||||
*/
|
||||
public void setMediaSource(Uri uri) {
|
||||
public boolean setMediaSource(Uri uri) {
|
||||
if (mMediaSourceUri != null && mMediaSourceUri.equals(uri)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
mMediaSourceUri = uri;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the media source of the player with a String path URL.
|
||||
* @see MediaPlayer#setDataSource(String)
|
||||
* @return Returns <code>true</code> if path represents a new media; <code>false</code>
|
||||
* otherwise.
|
||||
*/
|
||||
public boolean setMediaSource(String path) {
|
||||
if (mMediaSourcePath != null && mMediaSourcePath.equals(mMediaSourcePath)) {
|
||||
return false;
|
||||
}
|
||||
mMediaSourcePath = path;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void prepareMediaForPlaying() {
|
||||
reset();
|
||||
try {
|
||||
if (mMediaSourceUri != null) mPlayer.setDataSource(getContext(), mMediaSourceUri);
|
||||
@@ -323,13 +346,6 @@ public abstract class MediaPlayerGlue extends PlaybackControlGlue implements
|
||||
onStateChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see MediaPlayer#setDataSource(String)
|
||||
*/
|
||||
public void setMediaSource(String path) {
|
||||
mMediaSourcePath = path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call to <code>startPlayback(1)</code>.
|
||||
*
|
||||
|
||||
@@ -105,6 +105,7 @@ public class MusicConsumptionExampleFragment extends PlaybackOverlayFragment imp
|
||||
Uri uri = Utils.getResourceUri(getActivity(), song.getFileResource(getActivity()));
|
||||
mGlue.setMetaData(metaData);
|
||||
mGlue.setMediaSource(uri);
|
||||
mGlue.prepareMediaForPlaying();
|
||||
|
||||
addPlaybackControlsRow();
|
||||
}
|
||||
@@ -149,11 +150,12 @@ public class MusicConsumptionExampleFragment extends PlaybackOverlayFragment imp
|
||||
vh.getMediaItemNameView().setTextColor(favoriteTextColor);
|
||||
vh.getMediaItemDurationView().setTextColor(favoriteTextColor);
|
||||
} else {
|
||||
vh.getMediaItemNumberView().setTextAppearance(
|
||||
Context context = vh.getMediaItemNumberView().getContext();
|
||||
vh.getMediaItemNumberView().setTextAppearance(context,
|
||||
R.style.TextAppearance_Leanback_PlaybackMediaItemNumber);
|
||||
vh.getMediaItemNameView().setTextAppearance(
|
||||
vh.getMediaItemNameView().setTextAppearance(context,
|
||||
R.style.TextAppearance_Leanback_PlaybackMediaItemName);
|
||||
vh.getMediaItemDurationView().setTextAppearance(
|
||||
vh.getMediaItemDurationView().setTextAppearance(context,
|
||||
R.style.TextAppearance_Leanback_PlaybackMediaItemDuration);
|
||||
}
|
||||
}
|
||||
@@ -302,7 +304,10 @@ public class MusicConsumptionExampleFragment extends PlaybackOverlayFragment imp
|
||||
|
||||
Uri uri = Utils.getResourceUri(getActivity(), song.getFileResource(getActivity()));
|
||||
mGlue.setMetaData(metaData);
|
||||
mGlue.setMediaSource(uri);
|
||||
|
||||
if (mGlue.setMediaSource(uri)) {
|
||||
mGlue.prepareMediaForPlaying();
|
||||
}
|
||||
mGlue.startPlayback();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ public class VideoConsumptionExampleFragment extends PlaybackOverlayFragment imp
|
||||
metaData.setTitle("Diving with Sharks");
|
||||
mGlue.setMetaData(metaData);
|
||||
mGlue.setMediaSource(URL);
|
||||
mGlue.prepareMediaForPlaying();
|
||||
|
||||
|
||||
Fragment videoSurfaceFragment = getFragmentManager()
|
||||
|
||||
@@ -14,11 +14,14 @@
|
||||
|
||||
package android.support.v17.leanback.supportleanbackshowcase.app.wizard;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v17.leanback.supportleanbackshowcase.R;
|
||||
import android.support.v17.leanback.supportleanbackshowcase.app.media.VideoExampleActivity;
|
||||
import android.support.v17.leanback.widget.GuidanceStylist;
|
||||
import android.support.v17.leanback.widget.GuidedAction;
|
||||
import android.support.v4.app.ActivityOptionsCompat;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.List;
|
||||
@@ -60,10 +63,15 @@ public class WizardExample4thStepFragment extends WizardExampleBaseStepFragment
|
||||
|
||||
@Override
|
||||
public void onGuidedActionClicked(GuidedAction action) {
|
||||
if (ACTION_ID_WATCH == action.getId()) {
|
||||
Toast.makeText(getActivity(), getString(R.string.wizard_example_watch_now_clicked),
|
||||
if (action.getId() == ACTION_ID_WATCH) {
|
||||
finishGuidedStepFragments();
|
||||
Intent intent = new Intent(getActivity().getBaseContext(),
|
||||
VideoExampleActivity.class);
|
||||
startActivity(intent);
|
||||
} else if (action.getId() == ACTION_ID_LATER) {
|
||||
Toast.makeText(getActivity(), getString(R.string.wizard_example_later_clicked),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
finishGuidedStepFragments();
|
||||
}
|
||||
getActivity().finish();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<color name="song_row_favorite_color">#FF6E40</color>
|
||||
|
||||
<color name="app_guidedstep_actions_background">#C03800</color>
|
||||
<color name="app_guidedstep_subactions_background">#C03800</color>
|
||||
<color name="app_guidedstep_subactions_background">#732200</color>
|
||||
<color name="app_guidedstep_dialog_actions_background">#263238</color>
|
||||
<color name="settings_card_background">#0277BD</color>
|
||||
<color name="settings_card_background_focussed">#01579B</color>
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
<string name="wizard_example_watch_now">Watch now</string>
|
||||
<string name="wizard_example_later">Later</string>
|
||||
<string name="wizard_example_watch_now_clicked">\'Watch now\' clicked.</string>
|
||||
<string name="wizard_example_later_clicked">\'Later\' clicked.</string>
|
||||
<string name="wizard_example_new_payment_guidance_title">New credit card</string>
|
||||
<string name="wizard_example_new_payment_guidance_description">Enter new credit card information here</string>
|
||||
<string name="wizard_example_input_credit">Input Payment Type</string>
|
||||
|
||||
@@ -87,9 +87,9 @@
|
||||
<Preference
|
||||
android:selectable="false"
|
||||
android:summary="Hier steht ein voelligst sinnfreier Text den ja sowieso niemandhier lesen kann. Deshalb macht es auch keinen Unterschied ob hier sinnvolles und nicht so sinnvolles Zeug steht. Hm... Sasha, du kannst das vielleicht lesen und denkst dir jetzt auch, dass ich voll haengen geblieben bin, oder?... ^_^"></Preference>
|
||||
<Preference
|
||||
android:title="Force Stop"
|
||||
android:key="pref_force_stop"><!-- Start an Intent --></Preference>
|
||||
<SwitchPreference
|
||||
android:title="Notifications"
|
||||
android:key="pref_force_stop"><!-- Start an Intent --></SwitchPreference>
|
||||
<Preference
|
||||
android:title="Uninstall"
|
||||
android:key="pref_uninstall"><!-- Start an Intent --></Preference>
|
||||
|
||||
Reference in New Issue
Block a user