// Path: app/src/main/java/com/chrynan/android_guitar_tuner/di/module/PitchViewModule.java
// @Module
// public class PitchViewModule {
// 
//     private final PitchView view;
// 
//     public PitchViewModule(final PitchView view) {
//         this.view = view;
//     }
// 
//     @Provides
//     @FragmentScope
//     AudioManager provideAudioManager(@ApplicationContext final Context context) {
//         return (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
//     }
// 
//     @Provides
//     @FragmentScope
//     AudioConfig provideAudioConfig() {
//         return new AndroidAudioConfig();
//     }
// 
//     @Provides
//     @FragmentScope
//     AudioPlayer provideAudioPlayer(final AudioConfig audioConfig) {
//         return new AndroidAudioPlayer(audioConfig);
//     }
// 
//     @Provides
//     @FragmentScope
//     FrequencyConverter provideFrequencyConverter(final AudioConfig audioConfig) {
//         return new SineWaveFrequencyConverter(audioConfig);
//     }
// 
//     @Provides
//     @FragmentScope
//     PitchPlayer providePitchPlayer(final AudioPlayer audioPlayer, final FrequencyConverter frequencyConverter) {
//         return new GuitarPitchPlayer(audioPlayer, frequencyConverter);
//     }
// 
//     @Provides
//     @FragmentScope
//     VolumeObserver provideVolumeObserver(final AudioManager audioManager) {
//         return new AndroidVolumeObserver(audioManager);
//     }
// 
//     @Provides
//     @FragmentScope
//     PitchPresenter providePitchPresenter(final PitchPlayer pitchPlayer, final VolumeObserver volumeObserver) {
//         return new PitchPresenter(view, pitchPlayer, volumeObserver);
//     }
// }
// 
// Path: app/src/main/java/com/chrynan/android_guitar_tuner/ui/fragment/PitchPlayerFragment.java
// public class PitchPlayerFragment extends BaseFragment implements PitchView {
// 
//     public static final String TAG = "PitchPlayerFragment";
//     public static final String TITLE = "Pitch Playback";
// 
//     private static final String KEY_NOTE = "Note";
//     private static final String KEY_FREQUENCY = "Frequency";
// 
//     @BindView(R.id.containerConstraintLayout)
//     ConstraintLayout containerConstraintLayout;
//     @BindView(R.id.noteTextView)
//     TextView noteTextView;
//     @BindView(R.id.volumeStateTextView)
//     TextView volumeStateTextView;
// 
//     @Inject
//     PitchPresenter presenter;
// 
//     private double frequency;
// 
//     private Snackbar snackBar;
// 
//     public static PitchPlayerFragment newInstance(final String note, final double frequency) {
//         Bundle bundle = new Bundle();
//         bundle.putString(KEY_NOTE, note);
//         bundle.putDouble(KEY_FREQUENCY, frequency);
// 
//         PitchPlayerFragment fragment = new PitchPlayerFragment();
//         fragment.setArguments(bundle);
// 
//         return fragment;
//     }
// 
//     public PitchPlayerFragment() {
//         // Required empty public constructor
//     }
// 
//     @Override
//     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//         View v = inflateAndBindView(inflater, R.layout.fragment_pitch_player, container, false);
// 
//         if (getArguments() != null) {
//             String note = getArguments().getString(KEY_NOTE);
//             frequency = getArguments().getDouble(KEY_FREQUENCY);
// 
//             noteTextView.setText(note);
//         }
// 
//         return v;
//     }
// 
//     @Override
//     public void onResume() {
//         super.onResume();
// 
//         presenter.startPlayingNote(frequency);
//         presenter.startListeningToVolumeChanges();
//     }
// 
//     @Override
//     public void onPause() {
//         super.onPause();
// 
//         presenter.stopPlayingNote();
//         presenter.stopListeningToVolumeChanges();
// 
//         dismissSnackBar();
//     }
// 
//     @Override
//     public void onDestroyView() {
//         super.onDestroyView();
// 
//         presenter.detachView();
// 
//         unbinder.unbind();
//     }
// 
//     @Override
//     protected void setupDaggerComponent() {
//         DaggerPitchViewComponent.builder()
//                 .applicationComponent(GuitarTunerApplication.getApplicationComponent())
//                 .pitchViewModule(new PitchViewModule(this))
//                 .build()
//                 .inject(this);
//     }
// 
//     @Override
//     public void onUpdateVolumeState(@StringRes final int volumeStateText, @ColorRes final int textColor) {
//         volumeStateTextView.setText(volumeStateText);
//         volumeStateTextView.setTextColor(ContextCompat.getColor(getContext(), textColor));
//     }
// 
//     @Override
//     public void onErrorPlayingNote(@StringRes final int errorDescription, final boolean showAction,
//                                    @StringRes final int errorAction, @ColorRes final int actionColor) {
//         snackBar = Snackbar.make(containerConstraintLayout, errorDescription, Snackbar.LENGTH_INDEFINITE);
// 
//         if (showAction) {
//             snackBar.setAction(errorAction, onClick -> presenter.retryPlayingNote(frequency))
//                     .setActionTextColor(ContextCompat.getColor(getContext(), actionColor));
//         }
// 
//         snackBar.show();
//     }
// 
//     private void dismissSnackBar() {
//         if (snackBar != null) {
//             snackBar.dismiss();
//         }
//     }
// }
// 
// Path: app/src/main/java/com/chrynan/android_guitar_tuner/ui/view/PitchView.java
// public interface PitchView {
// 
//     void onUpdateVolumeState(@StringRes int volumeStateText, @ColorRes int textColor);
// 
//     void onErrorPlayingNote(@StringRes int errorDescription, boolean showAction, @StringRes int errorAction, @ColorRes int actionColor);
// }


import com.chrynan.android_guitar_tuner.di.FragmentScope;
import com.chrynan.android_guitar_tuner.di.module.PitchViewModule;
import com.chrynan.android_guitar_tuner.ui.fragment.PitchPlayerFragment;
import com.chrynan.android_guitar_tuner.ui.view.PitchView;
import dagger.Component;
package com.chrynan.android_guitar_tuner.di.component;



/**
 * A Dagger {@link Component} used for dependency injection in a {@link PitchView} implementation.
 */
@SuppressWarnings("WeakerAccess")
@Component(
        dependencies = ApplicationComponent.class,
// Path: app/src/main/java/com/chrynan/android_guitar_tuner/di/module/PitchViewModule.java
// @Module
// public class PitchViewModule {
// 
//     private final PitchView view;
// 
//     public PitchViewModule(final PitchView view) {
//         this.view = view;
//     }
// 
//     @Provides
//     @FragmentScope
//     AudioManager provideAudioManager(@ApplicationContext final Context context) {
//         return (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
//     }
// 
//     @Provides
//     @FragmentScope
//     AudioConfig provideAudioConfig() {
//         return new AndroidAudioConfig();
//     }
// 
//     @Provides
//     @FragmentScope
//     AudioPlayer provideAudioPlayer(final AudioConfig audioConfig) {
//         return new AndroidAudioPlayer(audioConfig);
//     }
// 
//     @Provides
//     @FragmentScope
//     FrequencyConverter provideFrequencyConverter(final AudioConfig audioConfig) {
//         return new SineWaveFrequencyConverter(audioConfig);
//     }
// 
//     @Provides
//     @FragmentScope
//     PitchPlayer providePitchPlayer(final AudioPlayer audioPlayer, final FrequencyConverter frequencyConverter) {
//         return new GuitarPitchPlayer(audioPlayer, frequencyConverter);
//     }
// 
//     @Provides
//     @FragmentScope
//     VolumeObserver provideVolumeObserver(final AudioManager audioManager) {
//         return new AndroidVolumeObserver(audioManager);
//     }
// 
//     @Provides
//     @FragmentScope
//     PitchPresenter providePitchPresenter(final PitchPlayer pitchPlayer, final VolumeObserver volumeObserver) {
//         return new PitchPresenter(view, pitchPlayer, volumeObserver);
//     }
// }
// 
// Path: app/src/main/java/com/chrynan/android_guitar_tuner/ui/fragment/PitchPlayerFragment.java
// public class PitchPlayerFragment extends BaseFragment implements PitchView {
// 
//     public static final String TAG = "PitchPlayerFragment";
//     public static final String TITLE = "Pitch Playback";
// 
//     private static final String KEY_NOTE = "Note";
//     private static final String KEY_FREQUENCY = "Frequency";
// 
//     @BindView(R.id.containerConstraintLayout)
//     ConstraintLayout containerConstraintLayout;
//     @BindView(R.id.noteTextView)
//     TextView noteTextView;
//     @BindView(R.id.volumeStateTextView)
//     TextView volumeStateTextView;
// 
//     @Inject
//     PitchPresenter presenter;
// 
//     private double frequency;
// 
//     private Snackbar snackBar;
// 
//     public static PitchPlayerFragment newInstance(final String note, final double frequency) {
//         Bundle bundle = new Bundle();
//         bundle.putString(KEY_NOTE, note);
//         bundle.putDouble(KEY_FREQUENCY, frequency);
// 
//         PitchPlayerFragment fragment = new PitchPlayerFragment();
//         fragment.setArguments(bundle);
// 
//         return fragment;
//     }
// 
//     public PitchPlayerFragment() {
//         // Required empty public constructor
//     }
// 
//     @Override
//     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//         View v = inflateAndBindView(inflater, R.layout.fragment_pitch_player, container, false);
// 
//         if (getArguments() != null) {
//             String note = getArguments().getString(KEY_NOTE);
//             frequency = getArguments().getDouble(KEY_FREQUENCY);
// 
//             noteTextView.setText(note);
//         }
// 
//         return v;
//     }
// 
//     @Override
//     public void onResume() {
//         super.onResume();
// 
//         presenter.startPlayingNote(frequency);
//         presenter.startListeningToVolumeChanges();
//     }
// 
//     @Override
//     public void onPause() {
//         super.onPause();
// 
//         presenter.stopPlayingNote();
//         presenter.stopListeningToVolumeChanges();
// 
//         dismissSnackBar();
//     }
// 
//     @Override
//     public void onDestroyView() {
//         super.onDestroyView();
// 
//         presenter.detachView();
// 
//         unbinder.unbind();
//     }
// 
//     @Override
//     protected void setupDaggerComponent() {
//         DaggerPitchViewComponent.builder()
//                 .applicationComponent(GuitarTunerApplication.getApplicationComponent())
//                 .pitchViewModule(new PitchViewModule(this))
//                 .build()
//                 .inject(this);
//     }
// 
//     @Override
//     public void onUpdateVolumeState(@StringRes final int volumeStateText, @ColorRes final int textColor) {
//         volumeStateTextView.setText(volumeStateText);
//         volumeStateTextView.setTextColor(ContextCompat.getColor(getContext(), textColor));
//     }
// 
//     @Override
//     public void onErrorPlayingNote(@StringRes final int errorDescription, final boolean showAction,
//                                    @StringRes final int errorAction, @ColorRes final int actionColor) {
//         snackBar = Snackbar.make(containerConstraintLayout, errorDescription, Snackbar.LENGTH_INDEFINITE);
// 
//         if (showAction) {
//             snackBar.setAction(errorAction, onClick -> presenter.retryPlayingNote(frequency))
//                     .setActionTextColor(ContextCompat.getColor(getContext(), actionColor));
//         }
// 
//         snackBar.show();
//     }
// 
//     private void dismissSnackBar() {
//         if (snackBar != null) {
//             snackBar.dismiss();
//         }
//     }
// }
// 
// Path: app/src/main/java/com/chrynan/android_guitar_tuner/ui/view/PitchView.java
// public interface PitchView {
// 
//     void onUpdateVolumeState(@StringRes int volumeStateText, @ColorRes int textColor);
// 
//     void onErrorPlayingNote(@StringRes int errorDescription, boolean showAction, @StringRes int errorAction, @ColorRes int actionColor);
// }


// Path: app/src/main/java/com/chrynan/android_guitar_tuner/di/component/PitchViewComponent.java
import com.chrynan.android_guitar_tuner.di.FragmentScope;
import com.chrynan.android_guitar_tuner.di.module.PitchViewModule;
import com.chrynan.android_guitar_tuner.ui.fragment.PitchPlayerFragment;
import com.chrynan.android_guitar_tuner.ui.view.PitchView;
import dagger.Component;

package com.chrynan.android_guitar_tuner.di.component;



/**
 * A Dagger {@link Component} used for dependency injection in a {@link PitchView} implementation.
 */
@SuppressWarnings("WeakerAccess")
@Component(
        dependencies = ApplicationComponent.class,
        modules = PitchViewModule.class