update libs, some refactoring

This commit is contained in:
Felix 2017-04-19 23:23:30 +02:00
parent 3e076fd383
commit 3f60a01c21
5 changed files with 24 additions and 23 deletions

View file

@ -46,8 +46,8 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:leanback-v17:25.3.0'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:leanback-v17:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
@ -55,7 +55,7 @@ dependencies {
compile 'com.squareup.retrofit2:retrofit:2.2.0'
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
compile 'com.squareup.retrofit2:adapter-rxjava2:2.2.0'
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.exoplayer:exoplayer:r2.3.1'
compile 'com.github.satyan:sugar:1.4'

View file

@ -9,6 +9,7 @@ import android.support.v17.leanback.widget.Presenter;
import android.support.v17.leanback.widget.Row;
import android.support.v17.leanback.widget.RowPresenter;
import android.support.v4.app.ActivityOptionsCompat;
import android.util.Log;
import de.nicidienase.chaosflix.activities.DetailsActivity;
import de.nicidienase.chaosflix.activities.EventDetailsActivity;
@ -22,6 +23,7 @@ import de.nicidienase.chaosflix.entities.streaming.Room;
*/
public class ItemViewClickedListener implements OnItemViewClickedListener {
private static final String TAG = ItemViewClickedListener.class.getSimpleName();
private Fragment fragment;
public ItemViewClickedListener(Fragment fragment) {
@ -31,6 +33,7 @@ public class ItemViewClickedListener implements OnItemViewClickedListener {
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
Log.d(TAG, "onItemClicked");
if (item instanceof Conference) {
Conference conference = (Conference) item;
// Start EventsActivity for this conference

View file

@ -7,4 +7,6 @@ import com.orm.SugarRecord;
*/
public class WatchlistItem extends SugarRecord {
int eventId;
}

View file

@ -55,11 +55,9 @@ import de.nicidienase.chaosflix.entities.recording.Event;
import io.reactivex.android.schedulers.AndroidSchedulers;
public class EventsBrowseFragment extends BrowseFragment {
private static final String TAG = "MainFragment";
private static final String TAG = EventsBrowseFragment.class.getSimpleName();
private static final int BACKGROUND_UPDATE_DELAY = 300;
private static final int GRID_ITEM_WIDTH = 200;
private static final int GRID_ITEM_HEIGHT = 200;
private static final int FRAGMENT = R.id.browse_fragment;
private final Handler mHandler = new Handler();
@ -95,7 +93,8 @@ public class EventsBrowseFragment extends BrowseFragment {
});
prepareBackgroundManager();
setupEventListeners();
setOnItemViewClickedListener(new ItemViewClickedListener(this));
setOnItemViewSelectedListener(new ItemViewSelectedListener());
}
@Override
@ -170,11 +169,6 @@ public class EventsBrowseFragment extends BrowseFragment {
}
private void setupEventListeners() {
setOnItemViewClickedListener(new ItemViewClickedListener(this));
setOnItemViewSelectedListener(new ItemViewSelectedListener());
}
protected void updateBackground(String uri) {
int width = mMetrics.widthPixels;
int height = mMetrics.heightPixels;

View file

@ -96,7 +96,12 @@ public class EventsDetailsFragment extends DetailsFragment {
.getParcelableExtra(DetailsActivity.ROOM);
}
final ArrayObjectAdapter adapter = setupDetailsOverviewRowPresenter();
FullWidthDetailsOverviewRowPresenter mDetailsPresenter
= setupDetailsOverviewRowPresenter();
ClassPresenterSelector mPresenterSelector = new ClassPresenterSelector();
mPresenterSelector.addClassPresenter(DetailsOverviewRow.class, mDetailsPresenter);
mPresenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
final ArrayObjectAdapter adapter = new ArrayObjectAdapter(mPresenterSelector);
((AbstractServiceConnectedAcitivty) getActivity()).getmApiServiceObservable()
.doOnError(t -> browseErrorFragment.setErrorContent(t.getMessage()))
@ -142,8 +147,8 @@ public class EventsDetailsFragment extends DetailsFragment {
}
setAdapter(adapter);
setOnItemViewClickedListener(
new ItemViewClickedListener(EventsDetailsFragment.this));
ItemViewClickedListener listener = new ItemViewClickedListener(EventsDetailsFragment.this);
setOnItemViewClickedListener(listener);
browseErrorFragment.dismiss();
});
});
@ -158,8 +163,7 @@ public class EventsDetailsFragment extends DetailsFragment {
detailsOverviewRow.setActionsAdapter(actionsAdapter);
adapter.add(detailsOverviewRow);
setAdapter(adapter);
setOnItemViewClickedListener(
new ItemViewClickedListener(EventsDetailsFragment.this));
setOnItemViewClickedListener(new ItemViewClickedListener(EventsDetailsFragment.this));
browseErrorFragment.dismiss();
}
// TODO add other streams
@ -234,7 +238,7 @@ public class EventsDetailsFragment extends DetailsFragment {
return selectedEvents;
}
private ArrayObjectAdapter setupDetailsOverviewRowPresenter() {
private FullWidthDetailsOverviewRowPresenter setupDetailsOverviewRowPresenter() {
FullWidthDetailsOverviewRowPresenter mDetailsPresenter = new FullWidthDetailsOverviewRowPresenter(
new EventDetailsDescriptionPresenter(getActivity()),
new EventDetailsOverviewLogoPresenter());
@ -250,6 +254,7 @@ public class EventsDetailsFragment extends DetailsFragment {
prepareEntranceTransition();
mDetailsPresenter.setOnActionClickedListener(action -> {
Log.d(TAG,"OnActionClicked");
Intent i = new Intent(getActivity(), PlayerActivity.class);
i.putExtra(DetailsActivity.TYPE, eventType);
if (eventType == DetailsActivity.TYPE_RECORDING) {
@ -276,15 +281,12 @@ public class EventsDetailsFragment extends DetailsFragment {
i.putExtra(DetailsActivity.STREAM_URL, streamUrl);
} else {
// TODO handle missing Stream
return;
}
}
getActivity().startActivity(i);
});
ClassPresenterSelector mPresenterSelector = new ClassPresenterSelector();
mPresenterSelector.addClassPresenter(DetailsOverviewRow.class, mDetailsPresenter);
mPresenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
return new ArrayObjectAdapter(mPresenterSelector);
return mDetailsPresenter;
}
private DetailsOverviewRow setupDetailsOverviewRow(Object event) {