Search in sources :

Example 91 with Nullable

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;
}
Also used : Cursor(android.database.Cursor) HashSet(java.util.HashSet) Nullable(android.support.annotation.Nullable)

Example 92 with Nullable

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;
}
Also used : SgListItem(com.uwetrottmann.seriesguide.backend.lists.model.SgListItem) ArrayList(java.util.ArrayList) Cursor(android.database.Cursor) SuppressLint(android.annotation.SuppressLint) Nullable(android.support.annotation.Nullable)

Example 93 with Nullable

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()))));
}
Also used : SyncEpisode(com.uwetrottmann.trakt5.entities.SyncEpisode) SyncItems(com.uwetrottmann.trakt5.entities.SyncItems) SyncShow(com.uwetrottmann.trakt5.entities.SyncShow) Cursor(android.database.Cursor) SyncSeason(com.uwetrottmann.trakt5.entities.SyncSeason) Nullable(android.support.annotation.Nullable)

Example 94 with Nullable

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;
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) SeekBar(android.widget.SeekBar) AppCompatSeekBar(android.support.v7.widget.AppCompatSeekBar) AppCompatActivity(android.support.v7.app.AppCompatActivity) ValueAnimator(android.animation.ValueAnimator) LottieAnimationView(com.airbnb.lottie.LottieAnimationView) BindView(butterknife.BindView) View(android.view.View) TextView(android.widget.TextView) Nullable(android.support.annotation.Nullable)

Example 95 with Nullable

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;
}
Also used : LottieAnimationView(com.airbnb.lottie.LottieAnimationView) BindView(butterknife.BindView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) Nullable(android.support.annotation.Nullable)

Aggregations

Nullable (android.support.annotation.Nullable)582 View (android.view.View)315 TextView (android.widget.TextView)163 RecyclerView (android.support.v7.widget.RecyclerView)85 BindView (butterknife.BindView)57 ImageView (android.widget.ImageView)52 ArrayList (java.util.ArrayList)43 IOException (java.io.IOException)36 Bundle (android.os.Bundle)35 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)35 Intent (android.content.Intent)32 ViewGroup (android.view.ViewGroup)32 Cursor (android.database.Cursor)29 Uri (android.net.Uri)27 File (java.io.File)24 AdapterView (android.widget.AdapterView)22 List (java.util.List)20 NonNull (android.support.annotation.NonNull)19 Context (android.content.Context)15 Bitmap (android.graphics.Bitmap)15