use of butterknife.Unbinder in project Shuttle by timusus.
the class QueueFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_queue, container, false);
unbinder = ButterKnife.bind(this, rootView);
toolbar.setNavigationOnClickListener(v -> getActivity().onBackPressed());
toolbar.inflateMenu(R.menu.menu_queue);
SubMenu sub = toolbar.getMenu().addSubMenu(0, MusicUtils.Defs.ADD_TO_PLAYLIST, 1, R.string.save_as_playlist);
disposables.add(PlaylistUtils.createUpdatingPlaylistMenu(sub).subscribe());
toolbar.setOnMenuItemClickListener(toolbarListener);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setRecyclerListener(new RecyclerListener());
recyclerView.setAdapter(adapter);
itemTouchHelper = new ItemTouchHelper(new ItemTouchHelperCallback((fromPosition, toPosition) -> adapter.moveItem(fromPosition, toPosition), MusicUtils::moveQueueItem, () -> {
// Nothing to do
}));
itemTouchHelper.attachToRecyclerView(recyclerView);
disposables.add(Aesthetic.get(getContext()).colorPrimary().subscribe(color -> {
boolean isLight = Util.isColorLight(color);
lineOne.setTextColor(isLight ? Color.BLACK : Color.WHITE);
lineTwo.setTextColor(isLight ? Color.BLACK : Color.WHITE);
}));
// In landscape, we need to adjust the status bar's translation depending on the slide offset of the sheet
if (ShuttleUtils.isLandscape()) {
statusBarView.setTranslationY(ResourceUtils.toPixels(16));
disposables.add(multiSheetSlideEventRelay.getEvents().filter(multiSheetEvent -> multiSheetEvent.sheet == MultiSheetView.Sheet.SECOND).filter(multiSheetEvent -> multiSheetEvent.slideOffset >= 0).subscribe(multiSheetEvent -> {
statusBarView.setTranslationY((1 - multiSheetEvent.slideOffset) * ResourceUtils.toPixels(16));
}));
}
setupContextualToolbar();
queuePresenter = new QueuePresenter(requestManager, cabHelper);
return rootView;
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class BindArrayTest method asCharSequenceArray.
@Test
public void asCharSequenceArray() {
CharSequenceArrayTarget target = new CharSequenceArrayTarget();
CharSequence[] expected = context.getResources().getTextArray(R.array.int_one_two_three);
Unbinder unbinder = new BindArrayTest$CharSequenceArrayTarget_ViewBinding(target, context);
assertThat(target.actual).isEqualTo(expected);
unbinder.unbind();
assertThat(target.actual).isEqualTo(expected);
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class BindArrayTest method asStringArray.
@Test
public void asStringArray() {
StringArrayTarget target = new StringArrayTarget();
String[] expected = context.getResources().getStringArray(R.array.string_one_two_three);
Unbinder unbinder = new BindArrayTest$StringArrayTarget_ViewBinding(target, context);
assertThat(target.actual).isEqualTo(expected);
unbinder.unbind();
assertThat(target.actual).isEqualTo(expected);
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class BindArrayTest method asIntArray.
@Test
public void asIntArray() {
IntArrayTarget target = new IntArrayTarget();
int[] expected = context.getResources().getIntArray(R.array.int_one_two_three);
Unbinder unbinder = new BindArrayTest$IntArrayTarget_ViewBinding(target, context);
assertThat(target.actual).isEqualTo(expected);
unbinder.unbind();
assertThat(target.actual).isEqualTo(expected);
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class BindColorTest method asInt.
@Test
public void asInt() {
IntTarget target = new IntTarget();
int expected = context.getResources().getColor(R.color.red);
Unbinder unbinder = new BindColorTest$IntTarget_ViewBinding(target, context);
assertThat(target.actual).isEqualTo(expected);
unbinder.unbind();
assertThat(target.actual).isEqualTo(expected);
}
Aggregations