Search in sources :

Example 46 with Unbinder

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 = ButterKnife.bind(target, tree);
    assertThat(target.actual).isEqualTo(expected);
    unbinder.unbind();
    assertThat(target.actual).isEqualTo(expected);
}
Also used : Unbinder(butterknife.Unbinder) Test(org.junit.Test)

Example 47 with Unbinder

use of butterknife.Unbinder in project butterknife by JakeWharton.

the class UnbinderTest method verifyContentViewBinding.

@Test
public void verifyContentViewBinding() {
    FrameLayout frameLayout = new FrameLayout(context);
    Button button1 = new Button(context);
    button1.setId(android.R.id.button1);
    frameLayout.addView(button1);
    Button button2 = new Button(context);
    button2.setId(android.R.id.button2);
    frameLayout.addView(button2);
    Button button3 = new Button(context);
    button3.setId(android.R.id.button3);
    frameLayout.addView(button3);
    View content = new View(context);
    content.setId(android.R.id.content);
    frameLayout.addView(content);
    H h = new H(frameLayout);
    Unbinder unbinder = ButterKnife.bind(h, frameLayout);
    verifyHBound(h);
    unbinder.unbind();
    verifyHUnbound(h);
}
Also used : Unbinder(butterknife.Unbinder) Button(android.widget.Button) FrameLayout(android.widget.FrameLayout) View(android.view.View) Test(org.junit.Test)

Example 48 with Unbinder

use of butterknife.Unbinder in project butterknife by JakeWharton.

the class OnItemLongClickTest method optionalIdAbsent.

@UiThreadTest
@Test
public void optionalIdAbsent() {
    View tree = ViewTree.create(TestSpinner.class, 2);
    TestSpinner spinner = tree.findViewById(2);
    OptionalId target = new OptionalId();
    Unbinder unbinder = ButterKnife.bind(target, tree);
    assertEquals(-1, target.clickedPosition);
    spinner.performItemLongClick(0);
    assertEquals(-1, target.clickedPosition);
    unbinder.unbind();
    spinner.performItemLongClick(0);
    assertEquals(-1, target.clickedPosition);
}
Also used : Unbinder(butterknife.Unbinder) View(android.view.View) AdapterView(android.widget.AdapterView) Test(org.junit.Test) UiThreadTest(androidx.test.annotation.UiThreadTest) UiThreadTest(androidx.test.annotation.UiThreadTest)

Example 49 with Unbinder

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;
}
Also used : TextUtils.isEmpty(android.text.TextUtils.isEmpty) Bundle(android.os.Bundle) ButterKnife(butterknife.ButterKnife) LayoutInflater(android.view.LayoutInflater) OnTextChanged(butterknife.OnTextChanged) ViewGroup(android.view.ViewGroup) BindView(butterknife.BindView) R(com.morihacky.android.rxjava.R) Disposable(io.reactivex.disposables.Disposable) TextView(android.widget.TextView) View(android.view.View) Nullable(android.support.annotation.Nullable) Unbinder(butterknife.Unbinder) PublishProcessor(io.reactivex.processors.PublishProcessor) EditText(android.widget.EditText) BindView(butterknife.BindView) TextView(android.widget.TextView) View(android.view.View)

Example 50 with Unbinder

use of butterknife.Unbinder in project Shuttle by timusus.

the class LibraryController method onCreateView.

@Nullable
@Override
public View onCreateView(@NonNull 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();
    compositeDisposable.add(Aesthetic.get(getContext()).colorPrimary().compose(distinctToMainThread()).subscribe(color -> ViewBackgroundAction.create(appBarLayout).accept(color), onErrorLogAndRethrow()));
    return rootView;
}
Also used : R(com.simplecity.amp_library.R) Genre(com.simplecity.amp_library.model.Genre) NavigationEventRelay(com.simplecity.amp_library.ui.screens.drawer.NavigationEventRelay) Bundle(android.os.Bundle) PlaylistDetailFragment(com.simplecity.amp_library.ui.screens.playlist.detail.PlaylistDetailFragment) AlbumDetailFragment(com.simplecity.amp_library.ui.screens.album.detail.AlbumDetailFragment) Rx.onErrorLogAndRethrow(com.afollestad.aesthetic.Rx.onErrorLogAndRethrow) CategoryItem(com.simplecity.amp_library.model.CategoryItem) AnalyticsManager(com.simplecity.amp_library.utils.AnalyticsManager) PagerAdapter(com.simplecity.amp_library.ui.adapters.PagerAdapter) BindView(butterknife.BindView) Aesthetic(com.afollestad.aesthetic.Aesthetic) View(android.view.View) ViewCompat(android.support.v4.view.ViewCompat) Transition(android.transition.Transition) PreferenceManager(android.preference.PreferenceManager) Unbinder(butterknife.Unbinder) Playlist(com.simplecity.amp_library.model.Playlist) IntentFilter(android.content.IntentFilter) Fragment(android.support.v4.app.Fragment) FragmentInfo(test.com.androidnavigation.fragment.FragmentInfo) CastManager(com.simplecity.amp_library.cast.CastManager) AlbumListFragment(com.simplecity.amp_library.ui.screens.album.list.AlbumListFragment) RxBroadcast(com.cantrowitz.rxbroadcast.RxBroadcast) AppCompatActivity(android.support.v7.app.AppCompatActivity) ViewGroup(android.view.ViewGroup) BaseFragment(com.simplecity.amp_library.ui.common.BaseFragment) SettingsManager(com.simplecity.amp_library.utils.SettingsManager) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) Disposable(io.reactivex.disposables.Disposable) List(java.util.List) Unit(kotlin.Unit) SearchFragment(com.simplecity.amp_library.ui.screens.search.SearchFragment) ContextualToolbarHost(com.simplecity.amp_library.ui.views.ContextualToolbarHost) Nullable(android.support.annotation.Nullable) AppBarLayout(android.support.design.widget.AppBarLayout) Album(com.simplecity.amp_library.model.Album) Stream(com.annimon.stream.Stream) ButterKnife(butterknife.ButterKnife) ContextualToolbar(com.simplecity.amp_library.ui.views.ContextualToolbar) ViewPager(android.support.v4.view.ViewPager) NonNull(android.support.annotation.NonNull) ArtistDetailFragment(com.simplecity.amp_library.ui.screens.artist.detail.ArtistDetailFragment) RatingSnackbar(com.simplecity.amp_library.ui.views.RatingSnackbar) MenuItem(android.view.MenuItem) ArrayList(java.util.ArrayList) TabLayout(android.support.design.widget.TabLayout) Inject(javax.inject.Inject) MultiSheetEventRelay(com.simplecity.amp_library.ui.views.multisheet.MultiSheetEventRelay) GenreDetailFragment(com.simplecity.amp_library.ui.screens.genre.detail.GenreDetailFragment) GenreListFragment(com.simplecity.amp_library.ui.screens.genre.list.GenreListFragment) MenuInflater(android.view.MenuInflater) Menu(android.view.Menu) ViewBackgroundAction(com.afollestad.aesthetic.ViewBackgroundAction) ShuttleUtils(com.simplecity.amp_library.utils.ShuttleUtils) Rx.distinctToMainThread(com.afollestad.aesthetic.Rx.distinctToMainThread) CastButtonFactory(com.google.android.gms.cast.framework.CastButtonFactory) PlaylistListFragment(com.simplecity.amp_library.ui.screens.playlist.list.PlaylistListFragment) MultiSheetView(com.simplecity.multisheetview.ui.view.MultiSheetView) LayoutInflater(android.view.LayoutInflater) AndroidSupportInjection(dagger.android.support.AndroidSupportInjection) ToolbarListener(com.simplecity.amp_library.ui.common.ToolbarListener) SuggestedFragment(com.simplecity.amp_library.ui.screens.suggested.SuggestedFragment) SharedPreferences(android.content.SharedPreferences) Toolbar(android.support.v7.widget.Toolbar) Pair(android.support.v4.util.Pair) TransitionInflater(android.transition.TransitionInflater) AlbumArtist(com.simplecity.amp_library.model.AlbumArtist) AlbumArtistListFragment(com.simplecity.amp_library.ui.screens.artist.list.AlbumArtistListFragment) AppCompatActivity(android.support.v7.app.AppCompatActivity) BindView(butterknife.BindView) View(android.view.View) MultiSheetView(com.simplecity.multisheetview.ui.view.MultiSheetView) Nullable(android.support.annotation.Nullable)

Aggregations

Unbinder (butterknife.Unbinder)82 Test (org.junit.Test)70 View (android.view.View)52 UiThreadTest (androidx.test.annotation.UiThreadTest)31 TextView (android.widget.TextView)21 AdapterView (android.widget.AdapterView)15 BindView (butterknife.BindView)13 Bundle (android.os.Bundle)12 LayoutInflater (android.view.LayoutInflater)12 ViewGroup (android.view.ViewGroup)12 ButterKnife (butterknife.ButterKnife)12 R (com.simplecity.amp_library.R)10 List (java.util.List)9 Nullable (android.support.annotation.Nullable)8 Aesthetic (com.afollestad.aesthetic.Aesthetic)8 CompositeDisposable (io.reactivex.disposables.CompositeDisposable)8 Inject (javax.inject.Inject)8 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)7 RecyclerView (android.support.v7.widget.RecyclerView)6 Rx.distinctToMainThread (com.afollestad.aesthetic.Rx.distinctToMainThread)6