use of butterknife.Unbinder in project apps-android-wikipedia by wikimedia.
the class LocalCompilationsFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View view = inflater.inflate(R.layout.fragment_local_compilations, container, false);
unbinder = ButterKnife.bind(this, view);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setAdapter(adapter);
recyclerView.addItemDecoration(new DrawableItemDecoration(getContext(), R.attr.list_separator_drawable));
((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
errorView.setBackClickListener(v -> getActivity().finish());
emptyDescription.setMovementMethod(LinkMovementMethod.getInstance());
emptyDescription.setText(StringUtil.fromHtml(getString(R.string.offline_library_empty_description_sideload)));
RichTextUtil.removeUnderlinesFromLinks(emptyDescription);
packsHint.setMovementMethod(LinkMovementMethod.getInstance());
packsHint.setText(StringUtil.fromHtml(getString(R.string.offline_library_packs_hint)));
RichTextUtil.removeUnderlinesFromLinks(packsHint);
dataUsageHint.setMovementMethod(new LinkMovementMethodExt((url, titleString) -> {
if (url.equals(UriUtil.LOCAL_URL_SETTINGS)) {
startActivity(SettingsActivity.newIntent(getContext()));
}
}));
dataUsageHint.setText(StringUtil.fromHtml(getString(R.string.offline_library_data_usage_hint)));
RichTextUtil.removeUnderlinesFromLinks(dataUsageHint);
funnel = new OfflineLibraryFunnel(WikipediaApp.getInstance(), 0);
return view;
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class BindBitmapTest method asBitmap.
@Test
public void asBitmap() {
Target target = new Target();
Bitmap expected = BitmapFactory.decodeResource(context.getResources(), R.drawable.pixel);
Unbinder unbinder = new BindBitmapTest$Target_ViewBinding(target, context);
assertTrue(target.actual.sameAs(expected));
unbinder.unbind();
assertTrue(target.actual.sameAs(expected));
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class BindBoolTest method asBoolean.
@Test
public void asBoolean() {
Target target = new Target();
boolean expected = context.getResources().getBoolean(R.bool.just_true);
Unbinder unbinder = new BindBoolTest$Target_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 asColorStateList.
@Test
public void asColorStateList() {
ColorStateListTarget target = new ColorStateListTarget();
ColorStateList expected = context.getResources().getColorStateList(R.color.colors);
Unbinder unbinder = new BindColorTest$ColorStateListTarget_ViewBinding(target, context);
assertThat(target.actual.toString()).isEqualTo(expected.toString());
unbinder.unbind();
assertThat(target.actual.toString()).isEqualTo(expected.toString());
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class BindDimenTest method asFloat.
@Test
public void asFloat() {
FloatTarget target = new FloatTarget();
float expected = context.getResources().getDimension(R.dimen.twelve_point_two_dp);
Unbinder unbinder = new BindDimenTest$FloatTarget_ViewBinding(target, context);
assertThat(target.actual).isEqualTo(expected);
unbinder.unbind();
assertThat(target.actual).isEqualTo(expected);
}
Aggregations