mirror of
https://github.com/NiciDieNase/chaosflix
synced 2024-11-23 04:43:07 +00:00
Leanback: convert some Activities to Kotlin
This commit is contained in:
parent
ee1ed6603f
commit
639637a125
10 changed files with 124 additions and 129 deletions
|
@ -37,32 +37,32 @@ public class ItemViewClickedListener implements OnItemViewClickedListener {
|
||||||
PersistentConference conference = (PersistentConference) item;
|
PersistentConference conference = (PersistentConference) item;
|
||||||
// Start EventsActivity for this conference
|
// Start EventsActivity for this conference
|
||||||
Intent i = new Intent(fragment.getActivity(), EventsActivity.class);
|
Intent i = new Intent(fragment.getActivity(), EventsActivity.class);
|
||||||
i.putExtra(EventsActivity.CONFERENCE, conference);
|
i.putExtra(EventsActivity.Companion.getCONFERENCE(), conference);
|
||||||
i.putExtra(EventsActivity.CONFERENCE_ACRONYM, conference.getAcronym());
|
i.putExtra(EventsActivity.Companion.getCONFERENCE_ACRONYM(), conference.getAcronym());
|
||||||
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
|
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
|
||||||
activity,
|
activity,
|
||||||
((ImageCardView) itemViewHolder.view).getMainImageView(),
|
((ImageCardView) itemViewHolder.view).getMainImageView(),
|
||||||
EventsActivity.SHARED_ELEMENT_NAME).toBundle();
|
EventsActivity.Companion.getSHARED_ELEMENT_NAME()).toBundle();
|
||||||
fragment.startActivity(i, bundle);
|
fragment.startActivity(i, bundle);
|
||||||
} else if (item instanceof PersistentEvent) {
|
} else if (item instanceof PersistentEvent) {
|
||||||
PersistentEvent event = (PersistentEvent) item;
|
PersistentEvent event = (PersistentEvent) item;
|
||||||
Intent i = new Intent(fragment.getActivity(), DetailsActivity.class);
|
Intent i = new Intent(fragment.getActivity(), DetailsActivity.class);
|
||||||
i.putExtra(DetailsActivity.TYPE, DetailsActivity.TYPE_RECORDING);
|
i.putExtra(DetailsActivity.Companion.getTYPE(), DetailsActivity.Companion.getTYPE_RECORDING());
|
||||||
i.putExtra(DetailsActivity.EVENT, event);
|
i.putExtra(DetailsActivity.Companion.getEVENT(), event);
|
||||||
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
|
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
|
||||||
activity,
|
activity,
|
||||||
((ImageCardView) itemViewHolder.view).getMainImageView(),
|
((ImageCardView) itemViewHolder.view).getMainImageView(),
|
||||||
EventDetailsActivity.SHARED_ELEMENT_NAME).toBundle();
|
EventDetailsActivity.Companion.getSHARED_ELEMENT_NAME()).toBundle();
|
||||||
activity.startActivity(i, bundle);
|
activity.startActivity(i, bundle);
|
||||||
} else if (item instanceof Room) {
|
} else if (item instanceof Room) {
|
||||||
Room room = (Room) item;
|
Room room = (Room) item;
|
||||||
Intent i = new Intent(fragment.getActivity(), DetailsActivity.class);
|
Intent i = new Intent(fragment.getActivity(), DetailsActivity.class);
|
||||||
i.putExtra(DetailsActivity.TYPE, DetailsActivity.TYPE_STREAM);
|
i.putExtra(DetailsActivity.Companion.getTYPE(), DetailsActivity.Companion.getTYPE_STREAM());
|
||||||
i.putExtra(DetailsActivity.ROOM, room);
|
i.putExtra(DetailsActivity.Companion.getROOM(), room);
|
||||||
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
|
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
|
||||||
activity,
|
activity,
|
||||||
((ImageCardView) itemViewHolder.view).getMainImageView(),
|
((ImageCardView) itemViewHolder.view).getMainImageView(),
|
||||||
EventDetailsActivity.SHARED_ELEMENT_NAME).toBundle();
|
EventDetailsActivity.Companion.getSHARED_ELEMENT_NAME()).toBundle();
|
||||||
activity.startActivity(i, bundle);
|
activity.startActivity(i, bundle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2014 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
|
||||||
* in compliance with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
||||||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
||||||
* or implied. See the License for the specific language governing permissions and limitations under
|
|
||||||
* the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.nicidienase.chaosflix.leanback.activities;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
|
|
||||||
import de.nicidienase.chaosflix.R;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Details activity class that loads LeanbackDetailsFragment class
|
|
||||||
*/
|
|
||||||
public class DetailsActivity extends AppCompatActivity {
|
|
||||||
|
|
||||||
public static final String SHARED_ELEMENT_NAME = "hero";
|
|
||||||
public static final String EVENT = "event";
|
|
||||||
public static final String ROOM = "room";
|
|
||||||
public static final String STREAM_URL = "stream_url";
|
|
||||||
public static final String RECORDING = "recording";
|
|
||||||
public static final String TYPE = "event_type";
|
|
||||||
public static final int TYPE_RECORDING = 0;
|
|
||||||
public static final int TYPE_STREAM = 1;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when the activity is first created.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_event_details);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
package de.nicidienase.chaosflix.leanback.activities
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.support.v7.app.AppCompatActivity
|
||||||
|
|
||||||
|
import de.nicidienase.chaosflix.R
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Details activity class that loads LeanbackDetailsFragment class
|
||||||
|
*/
|
||||||
|
class DetailsActivity : AppCompatActivity() {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the activity is first created.
|
||||||
|
*/
|
||||||
|
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setContentView(R.layout.activity_event_details)
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
val SHARED_ELEMENT_NAME = "hero"
|
||||||
|
@JvmStatic
|
||||||
|
val EVENT = "event"
|
||||||
|
@JvmStatic
|
||||||
|
val ROOM = "room"
|
||||||
|
@JvmStatic
|
||||||
|
val STREAM_URL = "stream_url"
|
||||||
|
@JvmStatic
|
||||||
|
val RECORDING = "recording"
|
||||||
|
@JvmStatic
|
||||||
|
val TYPE = "event_type"
|
||||||
|
@JvmStatic
|
||||||
|
val TYPE_RECORDING = 0
|
||||||
|
@JvmStatic
|
||||||
|
val TYPE_STREAM = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,23 +0,0 @@
|
||||||
package de.nicidienase.chaosflix.leanback.activities;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.PersistableBundle;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
|
|
||||||
import de.nicidienase.chaosflix.R;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by felix on 18.03.17.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class EventDetailsActivity extends AppCompatActivity {
|
|
||||||
|
|
||||||
public static final String EVENT = "event";
|
|
||||||
public static final String SHARED_ELEMENT_NAME = "transision_element";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
|
|
||||||
super.onCreate(savedInstanceState, persistentState);
|
|
||||||
setContentView(R.layout.activity_event_details);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package de.nicidienase.chaosflix.leanback.activities
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.os.PersistableBundle
|
||||||
|
import android.support.v7.app.AppCompatActivity
|
||||||
|
|
||||||
|
import de.nicidienase.chaosflix.R
|
||||||
|
|
||||||
|
|
||||||
|
class EventDetailsActivity : AppCompatActivity() {
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
|
||||||
|
super.onCreate(savedInstanceState, persistentState)
|
||||||
|
setContentView(R.layout.activity_event_details)
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
val EVENT = "event"
|
||||||
|
val SHARED_ELEMENT_NAME = "transision_element"
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,20 +0,0 @@
|
||||||
package de.nicidienase.chaosflix.leanback.activities;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
|
|
||||||
import de.nicidienase.chaosflix.R;
|
|
||||||
|
|
||||||
public class EventsActivity extends AppCompatActivity {
|
|
||||||
|
|
||||||
public static final String CONFERENCE_ACRONYM = "conference_acronym";
|
|
||||||
public static final String CONFERENCE = "conference";
|
|
||||||
public static final String SHARED_ELEMENT_NAME = "shared_element";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
// TODO determin if we should use a Browse or a Grid layout
|
|
||||||
setContentView(R.layout.activity_events_browse);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package de.nicidienase.chaosflix.leanback.activities
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.support.v7.app.AppCompatActivity
|
||||||
|
|
||||||
|
import de.nicidienase.chaosflix.R
|
||||||
|
|
||||||
|
class EventsActivity : AppCompatActivity() {
|
||||||
|
|
||||||
|
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
// TODO determin if we should use a Browse or a Grid layout
|
||||||
|
setContentView(R.layout.activity_events_browse)
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
val CONFERENCE_ACRONYM = "conference_acronym"
|
||||||
|
val CONFERENCE = "conference"
|
||||||
|
val SHARED_ELEMENT_NAME = "shared_element"
|
||||||
|
}
|
||||||
|
}
|
|
@ -77,8 +77,8 @@ public class EventsBrowseFragment extends BrowseFragment {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
final BrowseErrorFragment errorFragment =
|
final BrowseErrorFragment errorFragment =
|
||||||
BrowseErrorFragment.showErrorFragment(getFragmentManager(), FRAGMENT);
|
BrowseErrorFragment.showErrorFragment(getFragmentManager(), FRAGMENT);
|
||||||
conferenceId = this.getActivity().getIntent().getIntExtra(EventsActivity.CONFERENCE_ACRONYM, 0);
|
conferenceId = this.getActivity().getIntent().getIntExtra(EventsActivity.Companion.getCONFERENCE_ACRONYM(), 0);
|
||||||
mConference = this.getActivity().getIntent().getParcelableExtra(EventsActivity.CONFERENCE);
|
mConference = this.getActivity().getIntent().getParcelableExtra(EventsActivity.Companion.getCONFERENCE());
|
||||||
|
|
||||||
((LeanbackBaseActivity) getActivity()).getApiServiceObservable()
|
((LeanbackBaseActivity) getActivity()).getApiServiceObservable()
|
||||||
.subscribe(mediaApiService -> {
|
.subscribe(mediaApiService -> {
|
||||||
|
|
|
@ -115,29 +115,29 @@ public class EventsDetailsFragment extends DetailsFragment {
|
||||||
mRecordingActionsAdapter.replace(0, new Action(ADD_WATCHLIST_ACTION, EventsDetailsFragment.this.getString(R.string.add_to_watchlist)));
|
mRecordingActionsAdapter.replace(0, new Action(ADD_WATCHLIST_ACTION, EventsDetailsFragment.this.getString(R.string.add_to_watchlist)));
|
||||||
} else {
|
} else {
|
||||||
Intent i = new Intent(EventsDetailsFragment.this.getActivity(), PlayerActivity.class);
|
Intent i = new Intent(EventsDetailsFragment.this.getActivity(), PlayerActivity.class);
|
||||||
i.putExtra(DetailsActivity.TYPE, eventType);
|
i.putExtra(DetailsActivity.Companion.getTYPE(), eventType);
|
||||||
if (eventType == DetailsActivity.TYPE_RECORDING) {
|
if (eventType == DetailsActivity.Companion.getTYPE_RECORDING()) {
|
||||||
i.putExtra(DetailsActivity.EVENT, mSelectedEvent);
|
i.putExtra(DetailsActivity.Companion.getEVENT(), mSelectedEvent);
|
||||||
if (action.getId() == DUMMY_ID) {
|
if (action.getId() == DUMMY_ID) {
|
||||||
Recording dummy = new Recording();
|
Recording dummy = new Recording();
|
||||||
dummy.setRecordingUrl("https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8");
|
dummy.setRecordingUrl("https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8");
|
||||||
dummy.setMimeType("video/hls");
|
dummy.setMimeType("video/hls");
|
||||||
dummy.setLanguage("eng");
|
dummy.setLanguage("eng");
|
||||||
dummy.setHighQuality(true);
|
dummy.setHighQuality(true);
|
||||||
i.putExtra(DetailsActivity.RECORDING, dummy);
|
i.putExtra(DetailsActivity.Companion.getRECORDING(), dummy);
|
||||||
} else {
|
} else {
|
||||||
for (Recording r : mSelectedEvent.getRecordings()) {
|
for (Recording r : mSelectedEvent.getRecordings()) {
|
||||||
if (r.getApiID() == action.getId()) {
|
if (r.getApiID() == action.getId()) {
|
||||||
i.putExtra(DetailsActivity.RECORDING, r);
|
i.putExtra(DetailsActivity.Companion.getRECORDING(), r);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (eventType == DetailsActivity.TYPE_STREAM) {
|
} else if (eventType == DetailsActivity.Companion.getTYPE_STREAM()) {
|
||||||
i.putExtra(DetailsActivity.ROOM, mRoom);
|
i.putExtra(DetailsActivity.Companion.getROOM(), mRoom);
|
||||||
StreamUrl streamUrl = EventsDetailsFragment.this.getStreamUrlForActionId((int) action.getId());
|
StreamUrl streamUrl = EventsDetailsFragment.this.getStreamUrlForActionId((int) action.getId());
|
||||||
if (streamUrl != null) {
|
if (streamUrl != null) {
|
||||||
i.putExtra(DetailsActivity.STREAM_URL, streamUrl);
|
i.putExtra(DetailsActivity.Companion.getSTREAM_URL(), streamUrl);
|
||||||
} else {
|
} else {
|
||||||
// TODO handle missing Stream
|
// TODO handle missing Stream
|
||||||
return;
|
return;
|
||||||
|
@ -156,15 +156,15 @@ public class EventsDetailsFragment extends DetailsFragment {
|
||||||
prepareBackgroundManager();
|
prepareBackgroundManager();
|
||||||
final BrowseErrorFragment browseErrorFragment =
|
final BrowseErrorFragment browseErrorFragment =
|
||||||
BrowseErrorFragment.showErrorFragment(getFragmentManager(), FRAGMENT);
|
BrowseErrorFragment.showErrorFragment(getFragmentManager(), FRAGMENT);
|
||||||
eventType = getActivity().getIntent().getIntExtra(DetailsActivity.TYPE, -1);
|
eventType = getActivity().getIntent().getIntExtra(DetailsActivity.Companion.getTYPE(), -1);
|
||||||
|
|
||||||
if (eventType == DetailsActivity.TYPE_RECORDING) {
|
if (eventType == DetailsActivity.Companion.getTYPE_RECORDING()) {
|
||||||
mSelectedEvent = getActivity().getIntent()
|
mSelectedEvent = getActivity().getIntent()
|
||||||
.getParcelableExtra(DetailsActivity.EVENT);
|
.getParcelableExtra(DetailsActivity.Companion.getEVENT());
|
||||||
mWatchlistItem = WatchlistItem.findById(WatchlistItem.class, mSelectedEvent.getApiID());
|
mWatchlistItem = WatchlistItem.findById(WatchlistItem.class, mSelectedEvent.getApiID());
|
||||||
} else if (eventType == DetailsActivity.TYPE_STREAM) {
|
} else if (eventType == DetailsActivity.Companion.getTYPE_STREAM()) {
|
||||||
mRoom = getActivity().getIntent()
|
mRoom = getActivity().getIntent()
|
||||||
.getParcelableExtra(DetailsActivity.ROOM);
|
.getParcelableExtra(DetailsActivity.Companion.getROOM());
|
||||||
}
|
}
|
||||||
|
|
||||||
FullWidthDetailsOverviewRowPresenter mDetailsPresenter
|
FullWidthDetailsOverviewRowPresenter mDetailsPresenter
|
||||||
|
@ -178,7 +178,7 @@ public class EventsDetailsFragment extends DetailsFragment {
|
||||||
.doOnError(t -> browseErrorFragment.setErrorContent(t.getMessage()))
|
.doOnError(t -> browseErrorFragment.setErrorContent(t.getMessage()))
|
||||||
.subscribe(mediaApiService -> {
|
.subscribe(mediaApiService -> {
|
||||||
mMediaApiService = mediaApiService;
|
mMediaApiService = mediaApiService;
|
||||||
if (eventType == DetailsActivity.TYPE_RECORDING) {
|
if (eventType == DetailsActivity.Companion.getTYPE_RECORDING()) {
|
||||||
final DetailsOverviewRow detailsOverviewRow = setupDetailsOverviewRow(mSelectedEvent);
|
final DetailsOverviewRow detailsOverviewRow = setupDetailsOverviewRow(mSelectedEvent);
|
||||||
mediaApiService.getEvent(mSelectedEvent.getApiID())
|
mediaApiService.getEvent(mSelectedEvent.getApiID())
|
||||||
.doOnError(t -> browseErrorFragment.setErrorContent(t.getMessage()))
|
.doOnError(t -> browseErrorFragment.setErrorContent(t.getMessage()))
|
||||||
|
@ -222,7 +222,7 @@ public class EventsDetailsFragment extends DetailsFragment {
|
||||||
browseErrorFragment.dismiss();
|
browseErrorFragment.dismiss();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else if (eventType == DetailsActivity.TYPE_STREAM) {
|
} else if (eventType == DetailsActivity.Companion.getTYPE_STREAM()) {
|
||||||
mediaApiService.getStreamingConferences()
|
mediaApiService.getStreamingConferences()
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(liveConferences -> {
|
.subscribe(liveConferences -> {
|
||||||
|
@ -319,7 +319,7 @@ public class EventsDetailsFragment extends DetailsFragment {
|
||||||
FullWidthDetailsOverviewSharedElementHelper helper
|
FullWidthDetailsOverviewSharedElementHelper helper
|
||||||
= new FullWidthDetailsOverviewSharedElementHelper();
|
= new FullWidthDetailsOverviewSharedElementHelper();
|
||||||
helper.setSharedElementEnterTransition(getActivity(),
|
helper.setSharedElementEnterTransition(getActivity(),
|
||||||
EventDetailsActivity.SHARED_ELEMENT_NAME);
|
EventDetailsActivity.Companion.getSHARED_ELEMENT_NAME());
|
||||||
mDetailsPresenter.setListener(helper);
|
mDetailsPresenter.setListener(helper);
|
||||||
prepareEntranceTransition();
|
prepareEntranceTransition();
|
||||||
|
|
||||||
|
|
|
@ -136,19 +136,19 @@ public class OverlayFragment extends PlaybackFragment {
|
||||||
|
|
||||||
Intent intent = getActivity()
|
Intent intent = getActivity()
|
||||||
.getIntent();
|
.getIntent();
|
||||||
eventType = intent.getIntExtra(DetailsActivity.TYPE, -1);
|
eventType = intent.getIntExtra(DetailsActivity.Companion.getTYPE(), -1);
|
||||||
if (eventType == DetailsActivity.TYPE_RECORDING) {
|
if (eventType == DetailsActivity.Companion.getTYPE_RECORDING()) {
|
||||||
mSelectedEvent = intent.getParcelableExtra(DetailsActivity.EVENT);
|
mSelectedEvent = intent.getParcelableExtra(DetailsActivity.Companion.getEVENT());
|
||||||
mSelectedRecording = intent.getParcelableExtra(DetailsActivity.RECORDING);
|
mSelectedRecording = intent.getParcelableExtra(DetailsActivity.Companion.getRECORDING());
|
||||||
mHelper = new PlaybackHelper(getActivity(), this, mSelectedEvent, mSelectedRecording);
|
mHelper = new PlaybackHelper(getActivity(), this, mSelectedEvent, mSelectedRecording);
|
||||||
|
|
||||||
List<PlaybackProgress> progressList = PlaybackProgress.find(PlaybackProgress.class, "event_id = ?", String.valueOf(mSelectedEvent.getApiID()));
|
List<PlaybackProgress> progressList = PlaybackProgress.find(PlaybackProgress.class, "event_id = ?", String.valueOf(mSelectedEvent.getApiID()));
|
||||||
if (progressList.size() > 0) {
|
if (progressList.size() > 0) {
|
||||||
mPlaybackProgress = progressList.get(0);
|
mPlaybackProgress = progressList.get(0);
|
||||||
}
|
}
|
||||||
} else if (eventType == DetailsActivity.TYPE_STREAM) {
|
} else if (eventType == DetailsActivity.Companion.getTYPE_STREAM()) {
|
||||||
mSelectedRoom = intent.getParcelableExtra(DetailsActivity.ROOM);
|
mSelectedRoom = intent.getParcelableExtra(DetailsActivity.Companion.getROOM());
|
||||||
mSelectedStream = intent.getParcelableExtra(DetailsActivity.STREAM_URL);
|
mSelectedStream = intent.getParcelableExtra(DetailsActivity.Companion.getSTREAM_URL());
|
||||||
mHelper = new PlaybackHelper(getActivity(), this, mSelectedRoom, mSelectedStream);
|
mHelper = new PlaybackHelper(getActivity(), this, mSelectedRoom, mSelectedStream);
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "No Media found, finishing");
|
Log.d(TAG, "No Media found, finishing");
|
||||||
|
@ -181,19 +181,19 @@ public class OverlayFragment extends PlaybackFragment {
|
||||||
ps.addClassPresenter(ListRow.class, new ListRowPresenter());
|
ps.addClassPresenter(ListRow.class, new ListRowPresenter());
|
||||||
mRowsAdapter = new ArrayObjectAdapter(ps);
|
mRowsAdapter = new ArrayObjectAdapter(ps);
|
||||||
mRowsAdapter.add(controlsRow);
|
mRowsAdapter.add(controlsRow);
|
||||||
if (eventType == DetailsActivity.TYPE_RECORDING) {
|
if (eventType == DetailsActivity.Companion.getTYPE_RECORDING()) {
|
||||||
if (mSelectedEvent.getMetadata() != null && mSelectedEvent.getMetadata().getRelated() != null) {
|
if (mSelectedEvent.getMetadata() != null && mSelectedEvent.getMetadata().getRelated() != null) {
|
||||||
mRowsAdapter.add(getRelatedItems());
|
mRowsAdapter.add(getRelatedItems());
|
||||||
setOnItemViewClickedListener(new ItemViewClickedListener(this));
|
setOnItemViewClickedListener(new ItemViewClickedListener(this));
|
||||||
}
|
}
|
||||||
} else if (eventType == DetailsActivity.TYPE_STREAM) {
|
} else if (eventType == DetailsActivity.Companion.getTYPE_STREAM()) {
|
||||||
// TODO add other streams as related events
|
// TODO add other streams as related events
|
||||||
}
|
}
|
||||||
setAdapter(mRowsAdapter);
|
setAdapter(mRowsAdapter);
|
||||||
|
|
||||||
if (mCallback != null && eventType == DetailsActivity.TYPE_STREAM) {
|
if (mCallback != null && eventType == DetailsActivity.Companion.getTYPE_STREAM()) {
|
||||||
mCallback.setVideoSource(mSelectedStream.getUrl());
|
mCallback.setVideoSource(mSelectedStream.getUrl());
|
||||||
} else if (mCallback != null && eventType == DetailsActivity.TYPE_RECORDING) {
|
} else if (mCallback != null && eventType == DetailsActivity.Companion.getTYPE_RECORDING()) {
|
||||||
mCallback.setVideoSource(mSelectedRecording.getRecordingUrl());
|
mCallback.setVideoSource(mSelectedRecording.getRecordingUrl());
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "Callback not set or not event/stream");
|
Log.d(TAG, "Callback not set or not event/stream");
|
||||||
|
@ -255,7 +255,7 @@ public class OverlayFragment extends PlaybackFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCurrentPosition() {
|
public int getCurrentPosition() {
|
||||||
if (eventType == DetailsActivity.TYPE_RECORDING) {
|
if (eventType == DetailsActivity.Companion.getTYPE_RECORDING()) {
|
||||||
if (mCallback != null) {
|
if (mCallback != null) {
|
||||||
return (int) mCallback.getCurrentPosition();
|
return (int) mCallback.getCurrentPosition();
|
||||||
}
|
}
|
||||||
|
@ -264,7 +264,7 @@ public class OverlayFragment extends PlaybackFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getCurrentPositionLong() {
|
private long getCurrentPositionLong() {
|
||||||
if (eventType == DetailsActivity.TYPE_RECORDING) {
|
if (eventType == DetailsActivity.Companion.getTYPE_RECORDING()) {
|
||||||
if (mCallback != null) {
|
if (mCallback != null) {
|
||||||
return mCallback.getCurrentPosition();
|
return mCallback.getCurrentPosition();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue