use of butterknife.Unbinder in project Shuttle by timusus.
the class LibraryController method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.fragment_library, container, false);
unbinder = ButterKnife.bind(this, rootView);
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
setupViewPager();
Aesthetic.get(getContext()).colorPrimary().take(1).subscribe(color -> ViewBackgroundAction.create(appBarLayout).accept(color), onErrorLogAndRethrow());
compositeDisposable.add(Aesthetic.get(getContext()).colorPrimary().compose(distinctToMainThread()).subscribe(color -> ViewBackgroundAction.create(appBarLayout).accept(color), onErrorLogAndRethrow()));
return rootView;
}
use of butterknife.Unbinder in project Shuttle by timusus.
the class MiniPlayerFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.fragment_mini_player, container, false);
unbinder = ButterKnife.bind(this, rootView);
rootView.setOnClickListener(v -> {
MultiSheetView multiSheetView = MultiSheetView.getParentMultiSheetView(rootView);
if (multiSheetView != null) {
multiSheetView.expandSheet(MultiSheetView.Sheet.FIRST);
}
});
rootView.setOnTouchListener(new OnSwipeTouchListener(getActivity()));
playPauseView.setOnClickListener(v -> {
playPauseView.toggle();
playPauseView.postDelayed(() -> presenter.togglePlayback(), 200);
});
progressBar.setMax(1000);
disposable.add(Aesthetic.get(getContext()).colorPrimary().compose(distinctToMainThread()).subscribe(color -> {
boolean isDark = !Util.isColorLight(color);
trackName.setTextColor(isDark ? Color.WHITE : Color.BLACK);
artistName.setTextColor(isDark ? Color.WHITE : Color.BLACK);
ViewBackgroundAction.create(rootView).accept(color);
}, onErrorLogAndRethrow()));
return rootView;
}
use of butterknife.Unbinder in project Shuttle by timusus.
the class QueuePagerFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_queue_pager, container, false);
unbinder = ButterKnife.bind(this, rootView);
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false);
if (ShuttleUtils.isLandscape()) {
textProtectionScrim.setVisibility(View.GONE);
}
recyclerView.setNestedScrollingEnabled(false);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setAdapter(viewModelAdapter);
SnapHelper snapHelper = new PagerSnapHelper() {
@Override
public int findTargetSnapPosition(RecyclerView.LayoutManager layoutManager, int velocityX, int velocityY) {
int snapPosition = super.findTargetSnapPosition(layoutManager, velocityX, velocityY);
if (snapPosition < viewModelAdapter.items.size()) {
Observable.defer(() -> {
if (MusicUtils.getQueuePosition() != snapPosition) {
MusicUtils.setQueuePosition(snapPosition);
}
return Observable.empty();
}).delaySubscription(150, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.io()).subscribe();
}
return snapPosition;
}
};
snapHelper.attachToRecyclerView(recyclerView);
recyclerView.addOnScrollListener(new RecyclerViewPreloader<>(new ListPreloader.PreloadModelProvider<QueuePagerItemView>() {
@Override
public List<QueuePagerItemView> getPreloadItems(int position) {
QueuePagerItemView queuePagerItemView = (QueuePagerItemView) viewModelAdapter.items.get(position);
return Collections.singletonList(queuePagerItemView);
}
@Override
public GenericRequestBuilder getPreloadRequestBuilder(QueuePagerItemView item) {
return requestManager.load(item.song).diskCacheStrategy(DiskCacheStrategy.SOURCE).error(PlaceholderProvider.getInstance().getPlaceHolderDrawable(item.song.name, true));
}
}, (item, adapterPosition, perItemPosition) -> imageSize, 3));
recyclerView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
// This null check doesn't make sense to me, but there was an NPE here..
if (recyclerView != null) {
imageSize = new int[] { recyclerView.getWidth(), recyclerView.getHeight() };
recyclerView.getViewTreeObserver().removeOnPreDrawListener(this);
}
return false;
}
});
return rootView;
}
use of butterknife.Unbinder in project Shuttle by timusus.
the class BaseDetailFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_detail, container, false);
unbinder = ButterKnife.bind(this, rootView);
toolbar.setNavigationOnClickListener(v -> getNavigationController().popViewController());
if (ShuttleUtils.canDrawBehindStatusBar()) {
toolbar.getLayoutParams().height = (int) (ActionBarUtils.getActionBarHeight(getContext()) + ActionBarUtils.getStatusBarHeight(getContext()));
toolbar.setPadding(toolbar.getPaddingLeft(), (int) (toolbar.getPaddingTop() + ActionBarUtils.getStatusBarHeight(getContext())), toolbar.getPaddingRight(), toolbar.getPaddingBottom());
}
setupToolbarMenu(toolbar);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setRecyclerListener(new RecyclerListener());
recyclerView.setAdapter(adapter);
if (isFirstLoad) {
recyclerView.setLayoutAnimation(AnimationUtils.loadLayoutAnimation(getContext(), R.anim.layout_animation_from_bottom));
}
toolbarLayout.setTitle(getToolbarTitle());
toolbarLayout.setSubtitle(getToolbarSubtitle());
toolbarLayout.setExpandedTitleTypeface(TypefaceManager.getInstance().getTypeface(TypefaceManager.SANS_SERIF_LIGHT));
toolbarLayout.setCollapsedTitleTypeface(TypefaceManager.getInstance().getTypeface(TypefaceManager.SANS_SERIF));
setupContextualToolbar();
String transitionName = getArguments().getString(ARG_TRANSITION_NAME);
ViewCompat.setTransitionName(headerImageView, transitionName);
if (isFirstLoad) {
fab.setVisibility(View.GONE);
}
if (transitionName == null) {
fadeInUi();
}
detailPresenter.bindView(this);
loadBackgroundImage();
Aesthetic.get(getContext()).colorPrimary().take(1).subscribe(primaryColor -> {
toolbarLayout.setContentScrimColor(primaryColor);
toolbarLayout.setBackgroundColor(primaryColor);
});
disposables.add(Aesthetic.get(getContext()).colorPrimary().compose(distinctToMainThread()).subscribe(primaryColor -> {
toolbarLayout.setContentScrimColor(primaryColor);
toolbarLayout.setBackgroundColor(primaryColor);
}));
return rootView;
}
use of butterknife.Unbinder in project RxJava-Android-Samples by kaushikgopal.
the class DoubleBindingTextViewFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View layout = inflater.inflate(R.layout.fragment_double_binding_textview, container, false);
unbinder = ButterKnife.bind(this, layout);
_resultEmitterSubject = PublishProcessor.create();
_disposable = _resultEmitterSubject.subscribe(aFloat -> {
_result.setText(String.valueOf(aFloat));
});
onNumberChanged();
_number2.requestFocus();
return layout;
}
Aggregations