Search in sources :

Example 56 with Unbinder

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

Example 57 with Unbinder

use of butterknife.Unbinder in project butterknife by JakeWharton.

the class BindDimenTest method asInt.

@Test
public void asInt() {
    IntTarget target = new IntTarget();
    int expected = context.getResources().getDimensionPixelSize(R.dimen.twelve_point_two_dp);
    Unbinder unbinder = new BindDimenTest$IntTarget_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 58 with Unbinder

use of butterknife.Unbinder in project butterknife by JakeWharton.

the class BindFloatTest method asFloat.

@Test
public void asFloat() {
    Target target = new Target();
    TypedValue value = new TypedValue();
    context.getResources().getValue(R.dimen.twelve_point_two, value, true);
    float expected = value.getFloat();
    Unbinder unbinder = new BindFloatTest$Target_ViewBinding(target, context);
    assertThat(target.actual).isEqualTo(expected);
    unbinder.unbind();
    assertThat(target.actual).isEqualTo(expected);
}
Also used : Unbinder(butterknife.Unbinder) TypedValue(android.util.TypedValue) Test(org.junit.Test)

Example 59 with Unbinder

use of butterknife.Unbinder in project butterknife by JakeWharton.

the class BindStringTest method simpleInt.

@Test
public void simpleInt() {
    Target target = new Target();
    String expected = context.getString(R.string.hey);
    Unbinder unbinder = new BindStringTest$Target_ViewBinding(target, context);
    assertThat(target.actual).isEqualTo(expected);
    unbinder.unbind();
    assertThat(target.actual).isEqualTo(expected);
}
Also used : Unbinder(butterknife.Unbinder) BindString(butterknife.BindString) Test(org.junit.Test)

Example 60 with Unbinder

use of butterknife.Unbinder in project Shuttle by timusus.

the class MiniPlayerFragment method onCreateView.

@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.fragment_mini_player, container, false);
    unbinder = ButterKnife.bind(this, rootView);
    rootView.setOnClickListener(v -> {
        MultiSheetView multiSheetView = MultiSheetView.getParentMultiSheetView(rootView);
        if (multiSheetView != null) {
            multiSheetView.expandSheet(MultiSheetView.Sheet.FIRST);
        }
    });
    rootView.setOnTouchListener(new OnSwipeTouchListener(getActivity()));
    playPauseView.setOnClickListener(v -> playPauseView.toggle(() -> {
        presenter.togglePlayback();
        return Unit.INSTANCE;
    }));
    progressBar.setMax(1000);
    disposables.add(Aesthetic.get(getContext()).isDark().subscribe(isDark -> {
        int color = isDark ? getContext().getResources().getColor(android.R.color.primary_text_dark) : getContext().getResources().getColor(android.R.color.primary_text_light);
        titleTextView.setTextColor(color);
        playPauseView.setDrawableColor(color);
    }));
    return rootView;
}
Also used : R(com.simplecity.amp_library.R) Context(android.content.Context) GestureDetector(android.view.GestureDetector) Bundle(android.os.Bundle) ProgressBar(android.widget.ProgressBar) ButterKnife(butterknife.ButterKnife) ImageView(android.widget.ImageView) NonNull(android.support.annotation.NonNull) BindView(butterknife.BindView) Inject(javax.inject.Inject) Song(com.simplecity.amp_library.model.Song) Aesthetic(com.afollestad.aesthetic.Aesthetic) Priority(com.bumptech.glide.Priority) MotionEvent(android.view.MotionEvent) DiskCacheStrategy(com.bumptech.glide.load.engine.DiskCacheStrategy) View(android.view.View) Unbinder(butterknife.Unbinder) UpgradeDialog(com.simplecity.amp_library.ui.dialog.UpgradeDialog) PlayerPresenter(com.simplecity.amp_library.ui.screens.nowplaying.PlayerPresenter) PlaceholderProvider(com.simplecity.amp_library.utils.PlaceholderProvider) MultiSheetView(com.simplecity.multisheetview.ui.view.MultiSheetView) LayoutInflater(android.view.LayoutInflater) AndroidSupportInjection(dagger.android.support.AndroidSupportInjection) PlayPauseView(com.simplecity.amp_library.ui.views.PlayPauseView) ViewGroup(android.view.ViewGroup) BaseFragment(com.simplecity.amp_library.ui.common.BaseFragment) SettingsManager(com.simplecity.amp_library.utils.SettingsManager) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) Unit(kotlin.Unit) TextView(android.widget.TextView) Glide(com.bumptech.glide.Glide) PlayerViewAdapter(com.simplecity.amp_library.ui.views.PlayerViewAdapter) Nullable(android.support.annotation.Nullable) MultiSheetView(com.simplecity.multisheetview.ui.view.MultiSheetView)

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