Search in sources :

Example 6 with NonNull

use of android.support.annotation.NonNull in project Shuttle by timusus.

the class AlbumArtistAdapter method getSectionName.

@NonNull
@Override
public String getSectionName(int position) {
    if (!(items.get(position) instanceof AlbumArtistView)) {
        return "";
    }
    int sortOrder = SortManager.getInstance().getArtistsSortOrder();
    AlbumArtist albumArtist = ((AlbumArtistView) items.get(position)).albumArtist;
    String string = null;
    switch(sortOrder) {
        case SortManager.ArtistSort.DEFAULT:
            string = StringUtils.keyFor(albumArtist.name);
            break;
        case SortManager.AlbumSort.ARTIST_NAME:
            string = albumArtist.name;
            break;
    }
    if (!TextUtils.isEmpty(string)) {
        string = string.substring(0, 1).toUpperCase();
    } else {
        string = " ";
    }
    return string;
}
Also used : AlbumArtistView(com.simplecity.amp_library.ui.modelviews.AlbumArtistView) AlbumArtist(com.simplecity.amp_library.model.AlbumArtist) NonNull(android.support.annotation.NonNull)

Example 7 with NonNull

use of android.support.annotation.NonNull in project Shuttle by timusus.

the class TracksChooserDialog method onCreateDialog.

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    LayoutInflater inflater = getActivity().getLayoutInflater();
    // since dialog doesn't expose its root view at this point (doesn't exist yet), we cannot
    // attach to the unknown eventual parent, so we need to pass null for the rootView parameter
    // of the inflate() method
    @SuppressLint("InflateParams") View view = inflater.inflate(R.layout.custom_tracks_dialog_layout, null);
    setUpView(view);
    builder.setView(view).setPositiveButton(getString(R.string.ccl_ok), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int id) {
            List<MediaTrack> selectedTracks = new ArrayList<>();
            MediaTrack textTrack = mTextAdapter.getSelectedTrack();
            if (textTrack.getId() != TEXT_TRACK_NONE_ID) {
                selectedTracks.add(textTrack);
            }
            MediaTrack audioVideoTrack = mAudioVideoAdapter.getSelectedTrack();
            if (audioVideoTrack != null) {
                selectedTracks.add(audioVideoTrack);
            }
            // video track in this dialog
            if (!mVideoTracks.isEmpty()) {
                boolean foundMatch = false;
                for (MediaTrack videoTrack : mVideoTracks) {
                    for (Long activeTrackId : mCastManager.getActiveTrackIds()) {
                        if (videoTrack.getId() == activeTrackId) {
                            // we found an active video track
                            foundMatch = true;
                            selectedTracks.add(videoTrack);
                            break;
                        }
                    }
                    if (foundMatch) {
                        break;
                    }
                }
            }
            mCastManager.notifyTracksSelectedListeners(selectedTracks);
            TracksChooserDialog.this.getDialog().cancel();
        }
    }).setNegativeButton(R.string.ccl_cancel, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int id) {
            TracksChooserDialog.this.getDialog().cancel();
        }
    }).setOnCancelListener(new DialogInterface.OnCancelListener() {

        @Override
        public void onCancel(DialogInterface dialog) {
            TracksChooserDialog.this.getDialog().cancel();
        }
    });
    return builder.create();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView) SuppressLint(android.annotation.SuppressLint) MediaTrack(com.google.android.gms.cast.MediaTrack) LayoutInflater(android.view.LayoutInflater) SuppressLint(android.annotation.SuppressLint) ArrayList(java.util.ArrayList) List(java.util.List) NonNull(android.support.annotation.NonNull)

Example 8 with NonNull

use of android.support.annotation.NonNull in project Conductor by bluelinelabs.

the class FlipChangeHandler method getAnimator.

@Override
@NonNull
protected Animator getAnimator(@NonNull ViewGroup container, View from, View to, boolean isPush, boolean toAddedToContainer) {
    AnimatorSet animatorSet = new AnimatorSet();
    if (to != null) {
        to.setAlpha(0);
        ObjectAnimator rotation = ObjectAnimator.ofFloat(to, flipDirection.property, flipDirection.inStartRotation, 0).setDuration(animationDuration);
        rotation.setInterpolator(new AccelerateDecelerateInterpolator());
        animatorSet.play(rotation);
        Animator alpha = ObjectAnimator.ofFloat(to, View.ALPHA, 1).setDuration(animationDuration / 2);
        alpha.setStartDelay(animationDuration / 3);
        animatorSet.play(alpha);
    }
    if (from != null) {
        ObjectAnimator rotation = ObjectAnimator.ofFloat(from, flipDirection.property, 0, flipDirection.outEndRotation).setDuration(animationDuration);
        rotation.setInterpolator(new AccelerateDecelerateInterpolator());
        animatorSet.play(rotation);
        Animator alpha = ObjectAnimator.ofFloat(from, View.ALPHA, 0).setDuration(animationDuration / 2);
        alpha.setStartDelay(animationDuration / 3);
        animatorSet.play(alpha);
    }
    return animatorSet;
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AnimatorSet(android.animation.AnimatorSet) NonNull(android.support.annotation.NonNull)

Example 9 with NonNull

use of android.support.annotation.NonNull in project Conductor by bluelinelabs.

the class RxLifecycle2Controller method onCreateView.

@NonNull
@Override
protected View onCreateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) {
    Log.i(TAG, "onCreateView() called");
    View view = inflater.inflate(R.layout.controller_rxlifecycle, container, false);
    view.setBackgroundColor(ContextCompat.getColor(container.getContext(), R.color.brown_300));
    unbinder = ButterKnife.bind(this, view);
    tvTitle.setText(getResources().getString(R.string.rxlifecycle_title, TAG));
    Observable.interval(1, TimeUnit.SECONDS).doOnDispose(new Action() {

        @Override
        public void run() {
            Log.i(TAG, "Disposing from onCreateView)");
        }
    }).compose(this.<Long>bindUntilEvent(ControllerEvent.DESTROY_VIEW)).subscribe(new Consumer<Long>() {

        @Override
        public void accept(Long num) {
            Log.i(TAG, "Started in onCreateView(), running until onDestroyView(): " + num);
        }
    });
    return view;
}
Also used : Action(io.reactivex.functions.Action) BindView(butterknife.BindView) TextView(android.widget.TextView) View(android.view.View) NonNull(android.support.annotation.NonNull)

Example 10 with NonNull

use of android.support.annotation.NonNull in project Conductor by bluelinelabs.

the class LifecycleHandler method getRouter.

@NonNull
public Router getRouter(@NonNull ViewGroup container, @Nullable Bundle savedInstanceState) {
    ActivityHostedRouter router = routerMap.get(getRouterHashKey(container));
    if (router == null) {
        router = new ActivityHostedRouter();
        router.setHost(this, container);
        if (savedInstanceState != null) {
            Bundle routerSavedState = savedInstanceState.getBundle(KEY_ROUTER_STATE_PREFIX + router.getContainerId());
            if (routerSavedState != null) {
                router.restoreInstanceState(routerSavedState);
            }
        }
        routerMap.put(getRouterHashKey(container), router);
    } else {
        router.setHost(this, container);
    }
    return router;
}
Also used : Bundle(android.os.Bundle) ActivityHostedRouter(com.bluelinelabs.conductor.ActivityHostedRouter) NonNull(android.support.annotation.NonNull)

Aggregations

NonNull (android.support.annotation.NonNull)747 View (android.view.View)94 TextView (android.widget.TextView)90 ArrayList (java.util.ArrayList)83 Intent (android.content.Intent)53 ContentValues (android.content.ContentValues)46 Bundle (android.os.Bundle)46 Test (org.junit.Test)45 AlertDialog (android.support.v7.app.AlertDialog)41 Cursor (android.database.Cursor)38 List (java.util.List)34 IOException (java.io.IOException)32 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)31 LayoutInflater (android.view.LayoutInflater)29 RecyclerView (android.support.v7.widget.RecyclerView)28 ImageView (android.widget.ImageView)28 File (java.io.File)28 DialogAction (com.afollestad.materialdialogs.DialogAction)25 HashMap (java.util.HashMap)25 Bitmap (android.graphics.Bitmap)24