Search in sources :

Example 56 with Nullable

use of android.support.annotation.Nullable in project Transitions-Everywhere by andkulikov.

the class SlideSample method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_slide, container, false);
    final ViewGroup transitionsContainer = (ViewGroup) view.findViewById(R.id.transitions_container);
    final TextView text = (TextView) transitionsContainer.findViewById(R.id.text);
    transitionsContainer.findViewById(R.id.button).setOnClickListener(new VisibleToggleClickListener() {

        @Override
        protected void changeVisibility(boolean visible) {
            TransitionManager.beginDelayedTransition(transitionsContainer, new Slide(Gravity.RIGHT));
            text.setVisibility(visible ? View.VISIBLE : View.GONE);
        }
    });
    return view;
}
Also used : Slide(com.transitionseverywhere.Slide) ViewGroup(android.view.ViewGroup) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View) Nullable(android.support.annotation.Nullable)

Example 57 with Nullable

use of android.support.annotation.Nullable in project Transitions-Everywhere by andkulikov.

the class TransitionNameSample method onCreateView.

@Nullable
@Override
@SuppressLint("DefaultLocale")
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_names, container, false);
    final ViewGroup layout = (ViewGroup) view.findViewById(R.id.transitions_container);
    final Button button = (Button) view.findViewById(R.id.button1);
    final List<String> titles = new ArrayList<>();
    for (int i = 0; i < 5; i++) {
        titles.add(String.format("Item %d", i + 1));
    }
    createViews(inflater, layout, titles);
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            TransitionManager.beginDelayedTransition(layout, new ChangeBounds());
            Collections.shuffle(titles);
            createViews(inflater, layout, titles);
        }
    });
    return view;
}
Also used : Button(android.widget.Button) ViewGroup(android.view.ViewGroup) ChangeBounds(com.transitionseverywhere.ChangeBounds) ArrayList(java.util.ArrayList) TextView(android.widget.TextView) View(android.view.View) SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint) Nullable(android.support.annotation.Nullable)

Example 58 with Nullable

use of android.support.annotation.Nullable in project vlayout by alibaba.

the class BaseLayoutHelper method nextView.

/**
     * Retrieve next view and add it into layout, this is to make sure that view are added by order
     *
     * @param recycler    recycler generate views
     * @param layoutState current layout state
     * @param helper      helper to add views
     * @param result      chunk result to tell layoutManager whether layout process goes end
     * @return next view to render, null if no more view available
     */
@Nullable
public final View nextView(RecyclerView.Recycler recycler, LayoutStateWrapper layoutState, LayoutManagerHelper helper, LayoutChunkResult result) {
    View view = layoutState.next(recycler);
    if (view == null) {
        // no more items to layout.
        if (DEBUG && !layoutState.hasScrapList()) {
            throw new RuntimeException("received null view when unexpected");
        }
        // if there is no more views can be retrieved, this layout process is finished
        result.mFinished = true;
        return null;
    }
    helper.addChildView(layoutState, view);
    return view;
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) Nullable(android.support.annotation.Nullable)

Example 59 with Nullable

use of android.support.annotation.Nullable in project VideoPlayerManager by danylovolokh.

the class VideoPlayerManagerFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.video_player_manager_fragment, container, false);
    try {
        mVideoFileDecriptor_sample_1 = getActivity().getAssets().openFd("video_sample_1.mp4");
        mVideoFileDecriptor_sample_2 = getActivity().getAssets().openFd("video_sample_2.mp4");
    } catch (IOException e) {
        e.printStackTrace();
    }
    mVideoPlayer_1 = (VideoPlayerView) root.findViewById(R.id.video_player_1);
    mVideoPlayer_1.addMediaPlayerListener(new SimpleMainThreadMediaPlayerListener() {

        @Override
        public void onVideoPreparedMainThread() {
            // We hide the cover when video is prepared. Playback is about to start
            mVideoCover.setVisibility(View.INVISIBLE);
        }

        @Override
        public void onVideoStoppedMainThread() {
            // We show the cover when video is stopped
            mVideoCover.setVisibility(View.VISIBLE);
        }

        @Override
        public void onVideoCompletionMainThread() {
            // We show the cover when video is completed
            mVideoCover.setVisibility(View.VISIBLE);
        }
    });
    mVideoCover = (ImageView) root.findViewById(R.id.video_cover_1);
    mVideoCover.setOnClickListener(this);
    mVideoPlayer_2 = (VideoPlayerView) root.findViewById(R.id.video_player_2);
    mVideoPlayer_2.addMediaPlayerListener(new SimpleMainThreadMediaPlayerListener() {

        @Override
        public void onVideoPreparedMainThread() {
            // We hide the cover when video is prepared. Playback is about to start
            mVideoCover2.setVisibility(View.INVISIBLE);
        }

        @Override
        public void onVideoStoppedMainThread() {
            // We show the cover when video is stopped
            mVideoCover2.setVisibility(View.VISIBLE);
        }

        @Override
        public void onVideoCompletionMainThread() {
            // We show the cover when video is completed
            mVideoCover2.setVisibility(View.VISIBLE);
        }
    });
    mVideoCover2 = (ImageView) root.findViewById(R.id.video_cover_2);
    mVideoCover2.setOnClickListener(this);
    Picasso.with(getActivity()).load(R.drawable.video_sample_1_pic).into(mVideoCover);
    Picasso.with(getActivity()).load(R.drawable.video_sample_2_pic).into(mVideoCover2);
    return root;
}
Also used : SimpleMainThreadMediaPlayerListener(com.volokh.danylo.video_player_manager.ui.SimpleMainThreadMediaPlayerListener) IOException(java.io.IOException) ImageView(android.widget.ImageView) VideoPlayerView(com.volokh.danylo.video_player_manager.ui.VideoPlayerView) View(android.view.View) Nullable(android.support.annotation.Nullable)

Example 60 with Nullable

use of android.support.annotation.Nullable in project android-job by evernote.

the class WakeLockUtil method acquireWakeLock.

@Nullable
public static PowerManager.WakeLock acquireWakeLock(@NonNull Context context, @NonNull String tag, long timeoutMillis) {
    PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, tag);
    wakeLock.setReferenceCounted(false);
    return acquireWakeLock(context, wakeLock, timeoutMillis) ? wakeLock : null;
}
Also used : PowerManager(android.os.PowerManager) 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