Search in sources :

Example 6 with Unbinder

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());
}
Also used : Unbinder(butterknife.Unbinder) ColorStateList(android.content.res.ColorStateList) Test(org.junit.Test)

Example 7 with Unbinder

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);
}
Also used : Unbinder(butterknife.Unbinder) Test(org.junit.Test)

Example 8 with Unbinder

use of butterknife.Unbinder in project butterknife by JakeWharton.

the class BindDrawableTest method asDrawable.

@Test
public void asDrawable() {
    Target target = new Target();
    Drawable expected = context.getResources().getDrawable(R.drawable.circle);
    Unbinder unbinder = new BindDrawableTest$Target_ViewBinding(target, context);
    assertThat(target.actual.getConstantState()).isEqualTo(expected.getConstantState());
    unbinder.unbind();
    assertThat(target.actual.getConstantState()).isEqualTo(expected.getConstantState());
}
Also used : Unbinder(butterknife.Unbinder) BindDrawable(butterknife.BindDrawable) Drawable(android.graphics.drawable.Drawable) Test(org.junit.Test)

Example 9 with Unbinder

use of butterknife.Unbinder in project butterknife by JakeWharton.

the class BindIntTest method asInt.

@Test
public void asInt() {
    Target target = new Target();
    int expected = context.getResources().getInteger(R.integer.twelve);
    Unbinder unbinder = new BindIntTest$Target_ViewBinding(target, context);
    assertThat(target.actual).isEqualTo(expected);
    unbinder.unbind();
    assertThat(target.actual).isEqualTo(expected);
}
Also used : Unbinder(butterknife.Unbinder) Test(org.junit.Test)

Example 10 with Unbinder

use of butterknife.Unbinder in project Shuttle by timusus.

the class FolderFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_folder_browser, container, false);
    unbinder = ButterKnife.bind(this, rootView);
    if (displayedInTabs) {
        breadcrumbsView = new BreadcrumbsView(currentDir);
        showBreadcrumbsInList = true;
        changeBreadcrumbPath();
        appBarLayout.setVisibility(View.GONE);
        statusBarView.setVisibility(View.GONE);
    } else {
        showBreadcrumbsInList = false;
        breadcrumb.addBreadcrumbListener(this);
        if (!TextUtils.isEmpty(currentDir)) {
            breadcrumb.changeBreadcrumbPath(currentDir);
        }
    }
    if (!displayedInTabs) {
        toolbar.inflateMenu(R.menu.menu_folders);
        toolbar.setNavigationOnClickListener(v -> getNavigationController().popViewController());
        toolbar.setOnMenuItemClickListener(this);
        updateMenuItems(toolbar.getMenu());
    }
    recyclerView.setRecyclerListener(new RecyclerListener());
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setAdapter(adapter);
    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;
}
Also used : BreadcrumbsView(com.simplecity.amp_library.ui.modelviews.BreadcrumbsView) R(com.simplecity.amp_library.R) Bundle(android.os.Bundle) Rx.onErrorLogAndRethrow(com.afollestad.aesthetic.Rx.onErrorLogAndRethrow) ViewModel(com.simplecityapps.recycler_adapter.model.ViewModel) AndroidSchedulers(io.reactivex.android.schedulers.AndroidSchedulers) BindView(butterknife.BindView) Song(com.simplecity.amp_library.model.Song) Aesthetic(com.afollestad.aesthetic.Aesthetic) CheckBox(android.widget.CheckBox) MenuUtils(com.simplecity.amp_library.utils.MenuUtils) View(android.view.View) Schedulers(io.reactivex.schedulers.Schedulers) Unbinder(butterknife.Unbinder) BackPressListener(test.com.androidnavigation.fragment.BackPressListener) LogUtils(com.simplecity.amp_library.utils.LogUtils) ContextualToolbarHelper(com.simplecity.amp_library.utils.ContextualToolbarHelper) SortManager(com.simplecity.amp_library.utils.SortManager) FileHelper(com.simplecity.amp_library.utils.FileHelper) PopupMenu(android.support.v7.widget.PopupMenu) ViewGroup(android.view.ViewGroup) Breadcrumb(com.simplecity.amp_library.interfaces.Breadcrumb) SettingsManager(com.simplecity.amp_library.utils.SettingsManager) MusicUtils(com.simplecity.amp_library.utils.MusicUtils) List(java.util.List) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) Disposable(io.reactivex.disposables.Disposable) InclExclItem(com.simplecity.amp_library.model.InclExclItem) IntStream(com.annimon.stream.IntStream) BreadcrumbListener(com.simplecity.amp_library.interfaces.BreadcrumbListener) FileType(com.simplecity.amp_library.interfaces.FileType) AppBarLayout(android.support.design.widget.AppBarLayout) Stream(com.annimon.stream.Stream) ContextualToolbar(com.simplecity.amp_library.ui.views.ContextualToolbar) RecyclerListener(com.simplecityapps.recycler_adapter.recyclerview.RecyclerListener) ButterKnife(butterknife.ButterKnife) DrawerLockManager(com.simplecity.amp_library.ui.drawer.DrawerLockManager) ViewModelAdapter(com.simplecityapps.recycler_adapter.adapter.ViewModelAdapter) SelectableViewModel(com.simplecity.amp_library.ui.modelviews.SelectableViewModel) Single(io.reactivex.Single) FolderView(com.simplecity.amp_library.ui.modelviews.FolderView) MenuItem(android.view.MenuItem) ArrayList(java.util.ArrayList) SuppressLint(android.annotation.SuppressLint) MenuInflater(android.view.MenuInflater) Toast(android.widget.Toast) Menu(android.view.Menu) ViewBackgroundAction(com.afollestad.aesthetic.ViewBackgroundAction) BaseFileObject(com.simplecity.amp_library.model.BaseFileObject) Observable(io.reactivex.Observable) UpgradeDialog(com.simplecity.amp_library.ui.dialog.UpgradeDialog) ShuttleUtils(com.simplecity.amp_library.utils.ShuttleUtils) Rx.distinctToMainThread(com.afollestad.aesthetic.Rx.distinctToMainThread) Nullable(io.reactivex.annotations.Nullable) Collectors(com.annimon.stream.Collectors) FileBrowser(com.simplecity.amp_library.utils.FileBrowser) LayoutInflater(android.view.LayoutInflater) Function3(io.reactivex.functions.Function3) ThemedStatusBarView(com.simplecity.amp_library.ui.views.ThemedStatusBarView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) TextUtils(android.text.TextUtils) File(java.io.File) RecyclerView(android.support.v7.widget.RecyclerView) Toolbar(android.support.v7.widget.Toolbar) BreadcrumbItem(com.simplecity.amp_library.ui.views.BreadcrumbItem) BreadcrumbsView(com.simplecity.amp_library.ui.modelviews.BreadcrumbsView) DataManager(com.simplecity.amp_library.utils.DataManager) Collections(java.util.Collections) RecyclerListener(com.simplecityapps.recycler_adapter.recyclerview.RecyclerListener) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) BindView(butterknife.BindView) View(android.view.View) FolderView(com.simplecity.amp_library.ui.modelviews.FolderView) ThemedStatusBarView(com.simplecity.amp_library.ui.views.ThemedStatusBarView) RecyclerView(android.support.v7.widget.RecyclerView) BreadcrumbsView(com.simplecity.amp_library.ui.modelviews.BreadcrumbsView)

Aggregations

Unbinder (butterknife.Unbinder)23 Test (org.junit.Test)15 View (android.view.View)9 Bundle (android.os.Bundle)8 LayoutInflater (android.view.LayoutInflater)8 ViewGroup (android.view.ViewGroup)8 BindView (butterknife.BindView)8 ButterKnife (butterknife.ButterKnife)8 Nullable (android.support.annotation.Nullable)6 R (com.simplecity.amp_library.R)6 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)5 Aesthetic (com.afollestad.aesthetic.Aesthetic)5 List (java.util.List)5 RecyclerView (android.support.v7.widget.RecyclerView)4 Toolbar (android.support.v7.widget.Toolbar)4 MenuItem (android.view.MenuItem)4 TextView (android.widget.TextView)4 Rx.distinctToMainThread (com.afollestad.aesthetic.Rx.distinctToMainThread)4 ShuttleApplication (com.simplecity.amp_library.ShuttleApplication)4 Song (com.simplecity.amp_library.model.Song)4