Search in sources :

Example 51 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);
    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) PlaylistManager(com.simplecity.amp_library.utils.playlists.PlaylistManager) Rx.onErrorLogAndRethrow(com.afollestad.aesthetic.Rx.onErrorLogAndRethrow) ViewModel(com.simplecityapps.recycler_adapter.model.ViewModel) AnalyticsManager(com.simplecity.amp_library.utils.AnalyticsManager) 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) SongInfoDialog(com.simplecity.amp_library.ui.dialog.SongInfoDialog) TaggerDialog(com.simplecity.amp_library.ui.screens.tagger.TaggerDialog) View(android.view.View) RingtoneManager(com.simplecity.amp_library.utils.RingtoneManager) 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) FileHelper(com.simplecity.amp_library.utils.FileHelper) PopupMenu(android.support.v7.widget.PopupMenu) ViewGroup(android.view.ViewGroup) Breadcrumb(com.simplecity.amp_library.interfaces.Breadcrumb) BaseFragment(com.simplecity.amp_library.ui.common.BaseFragment) SettingsManager(com.simplecity.amp_library.utils.SettingsManager) SongExtKt(com.simplecity.amp_library.utils.extensions.SongExtKt) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) Disposable(io.reactivex.disposables.Disposable) List(java.util.List) Unit(kotlin.Unit) NotNull(org.jetbrains.annotations.NotNull) 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) ButterKnife(butterknife.ButterKnife) ContextualToolbar(com.simplecity.amp_library.ui.views.ContextualToolbar) RecyclerListener(com.simplecityapps.recycler_adapter.recyclerview.RecyclerListener) 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) Inject(javax.inject.Inject) SuppressLint(android.annotation.SuppressLint) Repository(com.simplecity.amp_library.data.Repository) 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) Rx.distinctToMainThread(com.afollestad.aesthetic.Rx.distinctToMainThread) Nullable(io.reactivex.annotations.Nullable) MenuUtils(com.simplecity.amp_library.utils.menu.MenuUtils) 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) SortManager(com.simplecity.amp_library.utils.sorting.SortManager) File(java.io.File) RecyclerView(android.support.v7.widget.RecyclerView) DrawerLockManager(com.simplecity.amp_library.ui.screens.drawer.DrawerLockManager) Toolbar(android.support.v7.widget.Toolbar) BreadcrumbItem(com.simplecity.amp_library.ui.views.BreadcrumbItem) BreadcrumbsView(com.simplecity.amp_library.ui.modelviews.BreadcrumbsView) PlaylistMenuHelper(com.simplecity.amp_library.utils.playlists.PlaylistMenuHelper) FolderMenuUtils(com.simplecity.amp_library.utils.menu.folder.FolderMenuUtils) 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)

Example 52 with Unbinder

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;
}
Also used : ItemTouchHelper(android.support.v7.widget.helper.ItemTouchHelper) R(com.simplecity.amp_library.R) CompletionListUpdateCallbackAdapter(com.simplecityapps.recycler_adapter.adapter.CompletionListUpdateCallbackAdapter) Bundle(android.os.Bundle) SongView(com.simplecity.amp_library.ui.modelviews.SongView) PlaylistUtils(com.simplecity.amp_library.utils.PlaylistUtils) ViewModel(com.simplecityapps.recycler_adapter.model.ViewModel) BindView(butterknife.BindView) Song(com.simplecity.amp_library.model.Song) Aesthetic(com.afollestad.aesthetic.Aesthetic) RequestManager(com.bumptech.glide.RequestManager) ItemTouchHelper(android.support.v7.widget.helper.ItemTouchHelper) MenuUtils(com.simplecity.amp_library.utils.MenuUtils) View(android.view.View) ResourceUtils(com.simplecity.amp_library.utils.ResourceUtils) Unbinder(butterknife.Unbinder) ItemTouchHelperCallback(com.simplecity.amp_library.ui.recyclerview.ItemTouchHelperCallback) ContextualToolbarHelper(com.simplecity.amp_library.utils.ContextualToolbarHelper) QueueView(com.simplecity.amp_library.ui.views.QueueView) SubMenu(android.view.SubMenu) ViewGroup(android.view.ViewGroup) MusicUtils(com.simplecity.amp_library.utils.MusicUtils) List(java.util.List) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) Disposable(io.reactivex.disposables.Disposable) TextView(android.widget.TextView) FragmentModule(com.simplecity.amp_library.dagger.module.FragmentModule) PermissionUtils(com.simplecity.amp_library.utils.PermissionUtils) Util(com.afollestad.aesthetic.Util) PlayerViewAdapter(com.simplecity.amp_library.ui.views.PlayerViewAdapter) Nullable(android.support.annotation.Nullable) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) ContextualToolbar(com.simplecity.amp_library.ui.views.ContextualToolbar) RecyclerListener(com.simplecityapps.recycler_adapter.recyclerview.RecyclerListener) ButterKnife(butterknife.ButterKnife) ViewModelAdapter(com.simplecityapps.recycler_adapter.adapter.ViewModelAdapter) SelectableViewModel(com.simplecity.amp_library.ui.modelviews.SelectableViewModel) Single(io.reactivex.Single) MenuItem(android.view.MenuItem) Inject(javax.inject.Inject) Toast(android.widget.Toast) UpgradeDialog(com.simplecity.amp_library.ui.dialog.UpgradeDialog) DeleteDialog(com.simplecity.amp_library.ui.dialog.DeleteDialog) ShuttleUtils(com.simplecity.amp_library.utils.ShuttleUtils) FastScrollRecyclerView(com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView) TaggerDialog(com.simplecity.amp_library.tagger.TaggerDialog) MultiSheetView(com.simplecity.multisheetview.ui.view.MultiSheetView) LayoutInflater(android.view.LayoutInflater) ThemedStatusBarView(com.simplecity.amp_library.ui.views.ThemedStatusBarView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) Color(android.graphics.Color) ShuttleApplication(com.simplecity.amp_library.ShuttleApplication) MultiSheetSlideEventRelay(com.simplecity.amp_library.ui.views.multisheet.MultiSheetSlideEventRelay) Toolbar(android.support.v7.widget.Toolbar) PlayerPresenter(com.simplecity.amp_library.ui.presenters.PlayerPresenter) QueuePresenter(com.simplecity.amp_library.ui.presenters.QueuePresenter) Callback(com.simplecity.amp_library.utils.ContextualToolbarHelper.Callback) QueuePresenter(com.simplecity.amp_library.ui.presenters.QueuePresenter) RecyclerListener(com.simplecityapps.recycler_adapter.recyclerview.RecyclerListener) SubMenu(android.view.SubMenu) MusicUtils(com.simplecity.amp_library.utils.MusicUtils) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SongView(com.simplecity.amp_library.ui.modelviews.SongView) BindView(butterknife.BindView) View(android.view.View) QueueView(com.simplecity.amp_library.ui.views.QueueView) TextView(android.widget.TextView) FastScrollRecyclerView(com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView) MultiSheetView(com.simplecity.multisheetview.ui.view.MultiSheetView) ThemedStatusBarView(com.simplecity.amp_library.ui.views.ThemedStatusBarView) ItemTouchHelperCallback(com.simplecity.amp_library.ui.recyclerview.ItemTouchHelperCallback)

Example 53 with Unbinder

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

Example 54 with Unbinder

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

Example 55 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 = new BindArrayTest$IntArrayTarget_ViewBinding(target, context);
    assertThat(target.actual).isEqualTo(expected);
    unbinder.unbind();
    assertThat(target.actual).isEqualTo(expected);
}
Also used : Unbinder(butterknife.Unbinder) Test(org.junit.Test)

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