Search in sources :

Example 1 with Injector

use of se.zinokader.spotiq.util.di.Injector in project SpotiQ by ZinoKader.

the class SpotifyAuthenticationActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_authentication);
    ((Injector) getApplication()).inject(this);
    overridePendingTransition(R.anim.short_fade_in, R.anim.short_fade_out);
    AuthenticationRequest authRequest = new AuthenticationRequest.Builder(BuildConfig.SPOTIFY_CLIENT_ID, AuthenticationResponse.Type.TOKEN, SpotifyConstants.REDIRECT_URI).setScopes(SpotifyConstants.DEFAULT_USER_SCOPES).build();
    AuthenticationClient.openLoginActivity(this, ApplicationConstants.LOGIN_INTENT_REQUEST_CODE, authRequest);
}
Also used : Injector(se.zinokader.spotiq.util.di.Injector) AuthenticationRequest(com.spotify.sdk.android.authentication.AuthenticationRequest)

Example 2 with Injector

use of se.zinokader.spotiq.util.di.Injector in project SpotiQ by ZinoKader.

the class TracklistFragment method onCreate.

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    ((Injector) getContext().getApplicationContext()).inject(this);
    super.onCreate(savedInstanceState);
    String partyTitle = getArguments().getString(ApplicationConstants.PARTY_NAME_EXTRA);
    itemAnimator.setInterpolator(new DecelerateInterpolator());
    itemAnimator.setAddDuration(ApplicationConstants.DEFAULT_ITEM_ADD_DURATION_MS);
    itemAnimator.setRemoveDuration(ApplicationConstants.DEFAULT_ITEM_REMOVE_DURATION_MS);
    itemAnimator.setMoveDuration(ApplicationConstants.DEFAULT_ITEM_MOVE_DURATION_MS);
    subscriptions.add(tracklistRepository.listenToTracklistChanges(partyTitle).delay(ApplicationConstants.DEFAULT_NEW_ITEM_DELAY_MS, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(childEvent -> {
        Song song = childEvent.getDataSnapshot().getValue(Song.class);
        switch(childEvent.getChangeType()) {
            case ADDED:
                addSong(song);
                break;
            case REMOVED:
                removeSong(song);
                break;
        }
    }));
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) FragmentTracklistBinding(se.zinokader.spotiq.databinding.FragmentTracklistBinding) Bundle(android.os.Bundle) CustomDividerItemDecoration(se.zinokader.spotiq.util.view.CustomDividerItemDecoration) LayoutInflater(android.view.LayoutInflater) Fragment(android.support.v4.app.Fragment) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) R(se.zinokader.spotiq.R) AndroidSchedulers(io.reactivex.android.schedulers.AndroidSchedulers) ViewGroup(android.view.ViewGroup) ArrayList(java.util.ArrayList) TimeUnit(java.util.concurrent.TimeUnit) Inject(javax.inject.Inject) ApplicationConstants(se.zinokader.spotiq.constant.ApplicationConstants) List(java.util.List) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) TracklistRepository(se.zinokader.spotiq.repository.TracklistRepository) DataBindingUtil(android.databinding.DataBindingUtil) FadeInDownAnimator(jp.wasabeef.recyclerview.animators.FadeInDownAnimator) Song(se.zinokader.spotiq.model.Song) View(android.view.View) Schedulers(io.reactivex.schedulers.Schedulers) Nullable(android.support.annotation.Nullable) Injector(se.zinokader.spotiq.util.di.Injector) DecelerateInterpolator(android.view.animation.DecelerateInterpolator) Song(se.zinokader.spotiq.model.Song) Injector(se.zinokader.spotiq.util.di.Injector)

Aggregations

Injector (se.zinokader.spotiq.util.di.Injector)2 DataBindingUtil (android.databinding.DataBindingUtil)1 Bundle (android.os.Bundle)1 Nullable (android.support.annotation.Nullable)1 Fragment (android.support.v4.app.Fragment)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)1 AuthenticationRequest (com.spotify.sdk.android.authentication.AuthenticationRequest)1 AndroidSchedulers (io.reactivex.android.schedulers.AndroidSchedulers)1 CompositeDisposable (io.reactivex.disposables.CompositeDisposable)1 Schedulers (io.reactivex.schedulers.Schedulers)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 TimeUnit (java.util.concurrent.TimeUnit)1 Inject (javax.inject.Inject)1 FadeInDownAnimator (jp.wasabeef.recyclerview.animators.FadeInDownAnimator)1 R (se.zinokader.spotiq.R)1