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