use of android.support.annotation.Nullable in project SeriesGuide by UweTrottmann.
the class ShowTools method getShowTvdbIdsAsSet.
/**
* Returns a set of the TVDb ids of all shows in the local database.
*
* @return null if there was an error, empty list if there are no shows.
*/
@Nullable
public static HashSet<Integer> getShowTvdbIdsAsSet(Context context) {
HashSet<Integer> existingShows = new HashSet<>();
Cursor shows = context.getContentResolver().query(SeriesGuideContract.Shows.CONTENT_URI, new String[] { SeriesGuideContract.Shows._ID }, null, null, null);
if (shows == null) {
return null;
}
while (shows.moveToNext()) {
existingShows.add(shows.getInt(0));
}
shows.close();
return existingShows;
}
use of android.support.annotation.Nullable in project SeriesGuide by UweTrottmann.
the class ListsTools method getListItems.
@Nullable
private static List<SgListItem> getListItems(Context context, String listId) {
SELECTION_ARG[0] = listId;
Cursor query = context.getContentResolver().query(SeriesGuideContract.ListItems.CONTENT_URI, Query.PROJECTION_LIST_ITEMS, SeriesGuideContract.ListItems.SELECTION_LIST, SELECTION_ARG, null);
if (query == null) {
// query failed
return null;
}
int itemCount = query.getCount();
if (itemCount == 0) {
query.close();
Timber.d("getListItems: no lists to upload.");
// no items in this list
return null;
}
List<SgListItem> items = new ArrayList<>(itemCount);
while (query.moveToNext()) {
SgListItem item = new SgListItem();
item.setListItemId(query.getString(Query.LIST_ITEM_ID));
items.add(item);
}
query.close();
return items;
}
use of android.support.annotation.Nullable in project SeriesGuide by UweTrottmann.
the class RateEpisodeTask method buildTraktSyncItems.
@Nullable
@Override
protected SyncItems buildTraktSyncItems() {
int season = -1;
int episode = -1;
int showTvdbId = -1;
Cursor query = getContext().getContentResolver().query(SeriesGuideContract.Episodes.buildEpisodeUri(episodeTvdbId), new String[] { SeriesGuideContract.Episodes.SEASON, SeriesGuideContract.Episodes.NUMBER, SeriesGuideContract.Shows.REF_SHOW_ID }, null, null, null);
if (query != null) {
if (query.moveToFirst()) {
season = query.getInt(0);
episode = query.getInt(1);
showTvdbId = query.getInt(2);
}
query.close();
}
if (season == -1 || episode == -1 || showTvdbId == -1) {
return null;
}
return new SyncItems().shows(new SyncShow().id(ShowIds.tvdb(showTvdbId)).seasons(new SyncSeason().number(season).episodes(new SyncEpisode().number(episode).rating(getRating()))));
}
use of android.support.annotation.Nullable in project lottie-android by airbnb.
the class AnimationFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_animation, container, false);
ButterKnife.bind(this, view);
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
toolbar.setNavigationIcon(R.drawable.ic_back);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getFragmentManager().popBackStack();
}
});
postUpdatePlayButtonText();
onLoopChanged();
animationView.addAnimatorListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
startRecordingDroppedFrames();
}
@Override
public void onAnimationEnd(Animator animation) {
recordDroppedFrames();
postUpdatePlayButtonText();
}
@Override
public void onAnimationCancel(Animator animation) {
postUpdatePlayButtonText();
}
@Override
public void onAnimationRepeat(Animator animation) {
recordDroppedFrames();
startRecordingDroppedFrames();
}
});
animationView.addAnimatorUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
seekBar.setProgress((int) (animation.getAnimatedFraction() * 100));
}
});
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (!animationView.isAnimating()) {
animationView.setProgress(progress / 100f);
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
return view;
}
use of android.support.annotation.Nullable in project lottie-android by airbnb.
the class ListFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_list, container, false);
ButterKnife.bind(this, view);
recyclerView.setAdapter(adapter);
return view;
}
Aggregations