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;
}
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();
}
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;
}
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;
}
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;
}
Aggregations