mirror of
https://github.com/NiciDieNase/chaosflix
synced 2024-11-26 22:20:24 +00:00
some refactoring
This commit is contained in:
parent
f11f51272b
commit
a5b5a59ca3
13 changed files with 30 additions and 27 deletions
|
@ -44,6 +44,8 @@ android {
|
|||
|
||||
|
||||
dependencies {
|
||||
implementation 'com.android.support:support-v4:25.4.0'
|
||||
implementation 'com.android.support:recyclerview-v7:25.4.0'
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'com.android.support:leanback-v17:25.4.0'
|
||||
compile 'com.android.support:appcompat-v7:25.4.0'
|
||||
|
@ -67,10 +69,10 @@ dependencies {
|
|||
debugCompile 'com.facebook.stetho:stetho-okhttp:1.4.2'
|
||||
debugCompile 'com.facebook.stetho:stetho-okhttp3:1.4.2'
|
||||
|
||||
androidTestCompile ('com.android.support.test:rules:0.5') {
|
||||
androidTestCompile('com.android.support.test:rules:0.5') {
|
||||
exclude module: 'support-annotations'
|
||||
}
|
||||
androidTestCompile ('com.android.support.test:runner:0.5') {
|
||||
androidTestCompile('com.android.support.test:runner:0.5') {
|
||||
exclude module: 'support-annotations'
|
||||
}
|
||||
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
|
||||
|
@ -83,3 +85,4 @@ dependencies {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
android:icon="@drawable/icon"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Leanback"
|
||||
android:name=".ChaosflixApplication">
|
||||
<activity
|
||||
android:name=".leanback.activities.ConferencesActivity"
|
||||
|
@ -24,6 +23,7 @@
|
|||
android:icon="@drawable/icon"
|
||||
android:label="@string/app_name"
|
||||
android:logo="@drawable/icon"
|
||||
android:theme="@style/Theme.Leanback"
|
||||
android:screenOrientation="landscape">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
|
|
|
@ -3,13 +3,13 @@ package de.nicidienase.chaosflix.leanback.activities;
|
|||
import android.os.Bundle;
|
||||
|
||||
import de.nicidienase.chaosflix.R;
|
||||
import de.nicidienase.chaosflix.shared.AbstractServiceConnectedActivity;
|
||||
import de.nicidienase.chaosflix.shared.ChaosflixBaseActivity;
|
||||
|
||||
/**
|
||||
* Created by felix on 18.03.17.
|
||||
*/
|
||||
|
||||
public class ConferencesActivity extends AbstractServiceConnectedActivity {
|
||||
public class ConferencesActivity extends ChaosflixBaseActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
|
|
@ -17,12 +17,12 @@ package de.nicidienase.chaosflix.leanback.activities;
|
|||
import android.os.Bundle;
|
||||
|
||||
import de.nicidienase.chaosflix.R;
|
||||
import de.nicidienase.chaosflix.shared.AbstractServiceConnectedActivity;
|
||||
import de.nicidienase.chaosflix.shared.ChaosflixBaseActivity;
|
||||
|
||||
/*
|
||||
* Details activity class that loads LeanbackDetailsFragment class
|
||||
*/
|
||||
public class DetailsActivity extends AbstractServiceConnectedActivity {
|
||||
public class DetailsActivity extends ChaosflixBaseActivity {
|
||||
|
||||
public static final String SHARED_ELEMENT_NAME = "hero";
|
||||
public static final String EVENT = "event";
|
||||
|
|
|
@ -4,13 +4,13 @@ import android.os.Bundle;
|
|||
import android.os.PersistableBundle;
|
||||
|
||||
import de.nicidienase.chaosflix.R;
|
||||
import de.nicidienase.chaosflix.shared.AbstractServiceConnectedActivity;
|
||||
import de.nicidienase.chaosflix.shared.ChaosflixBaseActivity;
|
||||
|
||||
/**
|
||||
* Created by felix on 18.03.17.
|
||||
*/
|
||||
|
||||
public class EventDetailsActivity extends AbstractServiceConnectedActivity {
|
||||
public class EventDetailsActivity extends ChaosflixBaseActivity {
|
||||
|
||||
public static final String EVENT = "event";
|
||||
public static final String SHARED_ELEMENT_NAME = "transision_element";
|
||||
|
|
|
@ -3,9 +3,9 @@ package de.nicidienase.chaosflix.leanback.activities;
|
|||
import android.os.Bundle;
|
||||
|
||||
import de.nicidienase.chaosflix.R;
|
||||
import de.nicidienase.chaosflix.shared.AbstractServiceConnectedActivity;
|
||||
import de.nicidienase.chaosflix.shared.ChaosflixBaseActivity;
|
||||
|
||||
public class EventsActivity extends AbstractServiceConnectedActivity {
|
||||
public class EventsActivity extends ChaosflixBaseActivity {
|
||||
|
||||
public static final String CONFERENCE_ID = "conference_id";
|
||||
public static final String CONFERENCE = "conference";
|
||||
|
|
|
@ -44,13 +44,13 @@ import butterknife.BindView;
|
|||
import butterknife.ButterKnife;
|
||||
import de.nicidienase.chaosflix.R;
|
||||
import de.nicidienase.chaosflix.leanback.fragments.OverlayFragment;
|
||||
import de.nicidienase.chaosflix.shared.AbstractServiceConnectedActivity;
|
||||
import de.nicidienase.chaosflix.shared.ChaosflixBaseActivity;
|
||||
|
||||
/**
|
||||
* Created by felix on 26.03.17.
|
||||
*/
|
||||
|
||||
public class PlayerActivity extends AbstractServiceConnectedActivity
|
||||
public class PlayerActivity extends ChaosflixBaseActivity
|
||||
implements OverlayFragment.PlaybackControlListener {
|
||||
|
||||
private static final String TAG = PlayerActivity.class.getSimpleName();
|
||||
|
|
|
@ -20,7 +20,7 @@ import de.nicidienase.chaosflix.BuildConfig;
|
|||
import de.nicidienase.chaosflix.leanback.CardPresenter;
|
||||
import de.nicidienase.chaosflix.leanback.ItemViewClickedListener;
|
||||
import de.nicidienase.chaosflix.R;
|
||||
import de.nicidienase.chaosflix.shared.AbstractServiceConnectedActivity;
|
||||
import de.nicidienase.chaosflix.shared.ChaosflixBaseActivity;
|
||||
import de.nicidienase.chaosflix.shared.entities.WatchlistItem;
|
||||
import de.nicidienase.chaosflix.shared.entities.recording.Conference;
|
||||
import de.nicidienase.chaosflix.shared.entities.recording.ConferencesWrapper;
|
||||
|
@ -68,7 +68,7 @@ public class ConferencesBrowseFragment extends BrowseFragment {
|
|||
mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
|
||||
watchListAdapter = new ArrayObjectAdapter(cardPresenter);
|
||||
|
||||
Disposable disposable = ((AbstractServiceConnectedActivity) getActivity()).getmApiServiceObservable()
|
||||
Disposable disposable = ((ChaosflixBaseActivity) getActivity()).getmApiServiceObservable()
|
||||
.subscribe(mediaApiService -> {
|
||||
mDisposables.add(Observable.zip(mediaApiService.getStreamingConferences(),
|
||||
mediaApiService.getConferences(),
|
||||
|
@ -165,7 +165,7 @@ public class ConferencesBrowseFragment extends BrowseFragment {
|
|||
}
|
||||
|
||||
private Disposable updateWatchlist(List<WatchlistItem> watchlistItems) {
|
||||
return ((AbstractServiceConnectedActivity) getActivity()).getmApiServiceObservable()
|
||||
return ((ChaosflixBaseActivity) getActivity()).getmApiServiceObservable()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(mediaApiService -> {
|
||||
showWatchlist();
|
||||
|
|
|
@ -11,7 +11,7 @@ import java.util.List;
|
|||
|
||||
import de.nicidienase.chaosflix.leanback.CardPresenter;
|
||||
import de.nicidienase.chaosflix.leanback.ItemViewClickedListener;
|
||||
import de.nicidienase.chaosflix.shared.AbstractServiceConnectedActivity;
|
||||
import de.nicidienase.chaosflix.shared.ChaosflixBaseActivity;
|
||||
import de.nicidienase.chaosflix.shared.entities.recording.Conference;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
|
||||
|
@ -29,7 +29,7 @@ public class ConferencesGridFragment extends VerticalGridFragment {
|
|||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
((AbstractServiceConnectedActivity) getActivity()).getmApiServiceObservable()
|
||||
((ChaosflixBaseActivity) getActivity()).getmApiServiceObservable()
|
||||
.subscribe(mediaApiService -> {
|
||||
mediaApiService.getConferences()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
|
|
|
@ -48,7 +48,7 @@ import java.util.TimerTask;
|
|||
import de.nicidienase.chaosflix.leanback.CardPresenter;
|
||||
import de.nicidienase.chaosflix.leanback.ItemViewClickedListener;
|
||||
import de.nicidienase.chaosflix.R;
|
||||
import de.nicidienase.chaosflix.shared.AbstractServiceConnectedActivity;
|
||||
import de.nicidienase.chaosflix.shared.ChaosflixBaseActivity;
|
||||
import de.nicidienase.chaosflix.leanback.activities.EventsActivity;
|
||||
import de.nicidienase.chaosflix.shared.entities.recording.Conference;
|
||||
import de.nicidienase.chaosflix.shared.entities.recording.Event;
|
||||
|
@ -79,7 +79,7 @@ public class EventsBrowseFragment extends BrowseFragment {
|
|||
conferenceId = this.getActivity().getIntent().getIntExtra(EventsActivity.CONFERENCE_ID, 0);
|
||||
mConference = this.getActivity().getIntent().getParcelableExtra(EventsActivity.CONFERENCE);
|
||||
|
||||
((AbstractServiceConnectedActivity) getActivity()).getmApiServiceObservable()
|
||||
((ChaosflixBaseActivity) getActivity()).getmApiServiceObservable()
|
||||
.subscribe(mediaApiService -> {
|
||||
mediaApiService.getConference(mConference.getApiID())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
|
|
|
@ -42,7 +42,7 @@ import de.nicidienase.chaosflix.leanback.CardPresenter;
|
|||
import de.nicidienase.chaosflix.leanback.EventDetailsDescriptionPresenter;
|
||||
import de.nicidienase.chaosflix.leanback.ItemViewClickedListener;
|
||||
import de.nicidienase.chaosflix.R;
|
||||
import de.nicidienase.chaosflix.shared.AbstractServiceConnectedActivity;
|
||||
import de.nicidienase.chaosflix.shared.ChaosflixBaseActivity;
|
||||
import de.nicidienase.chaosflix.leanback.activities.ConferencesActivity;
|
||||
import de.nicidienase.chaosflix.leanback.activities.DetailsActivity;
|
||||
import de.nicidienase.chaosflix.leanback.activities.EventDetailsActivity;
|
||||
|
@ -174,7 +174,7 @@ public class EventsDetailsFragment extends DetailsFragment {
|
|||
mPresenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
|
||||
final ArrayObjectAdapter adapter = new ArrayObjectAdapter(mPresenterSelector);
|
||||
|
||||
((AbstractServiceConnectedActivity) getActivity()).getmApiServiceObservable()
|
||||
((ChaosflixBaseActivity) getActivity()).getmApiServiceObservable()
|
||||
.doOnError(t -> browseErrorFragment.setErrorContent(t.getMessage()))
|
||||
.subscribe(mediaApiService -> {
|
||||
mMediaApiService = mediaApiService;
|
||||
|
|
|
@ -26,7 +26,7 @@ import de.nicidienase.chaosflix.leanback.CardPresenter;
|
|||
import de.nicidienase.chaosflix.leanback.ItemViewClickedListener;
|
||||
import de.nicidienase.chaosflix.leanback.PlaybackHelper;
|
||||
import de.nicidienase.chaosflix.R;
|
||||
import de.nicidienase.chaosflix.shared.AbstractServiceConnectedActivity;
|
||||
import de.nicidienase.chaosflix.shared.ChaosflixBaseActivity;
|
||||
import de.nicidienase.chaosflix.leanback.activities.DetailsActivity;
|
||||
import de.nicidienase.chaosflix.shared.entities.PlaybackProgress;
|
||||
import de.nicidienase.chaosflix.shared.entities.recording.Event;
|
||||
|
@ -229,7 +229,7 @@ public class OverlayFragment extends PlaybackFragment {
|
|||
private Row getRelatedItems() {
|
||||
ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter());
|
||||
final long[] related = mSelectedEvent.getMetadata().getRelated();
|
||||
mDisposables.add(((AbstractServiceConnectedActivity) getActivity()).getmApiServiceObservable()
|
||||
mDisposables.add(((ChaosflixBaseActivity) getActivity()).getmApiServiceObservable()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
mediaApiService -> {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package de.nicidienase.chaosflix.shared;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
@ -9,6 +8,7 @@ import android.os.Bundle;
|
|||
import android.os.IBinder;
|
||||
import android.os.PersistableBundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
import de.nicidienase.chaosflix.shared.network.MediaApiService;
|
||||
import io.reactivex.Single;
|
||||
|
@ -17,7 +17,7 @@ import io.reactivex.Single;
|
|||
* Created by felix on 24.03.17.
|
||||
*/
|
||||
|
||||
public class AbstractServiceConnectedActivity extends Activity {
|
||||
public class ChaosflixBaseActivity extends AppCompatActivity {
|
||||
private MediaApiService mMediaApiService = null;
|
||||
private ServiceConnection conn;
|
||||
private boolean mConnected = false;
|
||||
|
@ -63,7 +63,7 @@ public class AbstractServiceConnectedActivity extends Activity {
|
|||
mConnected = false;
|
||||
}
|
||||
};
|
||||
AbstractServiceConnectedActivity.this.bindService(s, conn, Context.BIND_AUTO_CREATE);
|
||||
ChaosflixBaseActivity.this.bindService(s, conn, Context.BIND_AUTO_CREATE);
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Reference in a new issue