use of org.gateshipone.malp.application.artworkdatabase.fanartcache.FanartCacheManager in project malp by gateship-one.
the class FanartActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mDecorView = getWindow().getDecorView();
setContentView(R.layout.activity_artist_fanart);
mInfoLayout = findViewById(R.id.information_layout);
mTrackTitle = findViewById(R.id.textview_track_title);
mTrackAlbum = findViewById(R.id.textview_track_album);
mTrackArtist = findViewById(R.id.textview_track_artist);
mSwitcher = findViewById(R.id.fanart_switcher);
mFanartView0 = findViewById(R.id.fanart_view_0);
mFanartView1 = findViewById(R.id.fanart_view_1);
mPreviousButton = findViewById(R.id.button_previous_track);
mNextButton = findViewById(R.id.button_next_track);
mStopButton = findViewById(R.id.button_stop);
mPlayPauseButton = findViewById(R.id.button_playpause);
mPreviousButton.setOnClickListener(v -> MPDCommandHandler.previousSong());
mNextButton.setOnClickListener(v -> MPDCommandHandler.nextSong());
mStopButton.setOnClickListener(view -> MPDCommandHandler.stop());
mPlayPauseButton.setOnClickListener(view -> MPDCommandHandler.togglePause());
if (null == mStateListener) {
mStateListener = new ServerStatusListener();
}
mInfoLayout.setOnClickListener(view -> {
});
mSwitcher.setOnClickListener(v -> {
cancelSwitching();
mSwitchTimer = new Timer();
mSwitchTimer.schedule(new ViewSwitchTask(), FANART_SWITCH_TIME, FANART_SWITCH_TIME);
updateFanartViews();
});
// seekbar (position)
mPositionSeekbar = findViewById(R.id.now_playing_seekBar);
mPositionSeekbar.setOnSeekBarChangeListener(new PositionSeekbarListener());
mVolumeSeekbar = findViewById(R.id.volume_seekbar);
mVolumeIcon = findViewById(R.id.volume_icon);
mVolumeIcon.setOnClickListener(view -> MPDCommandHandler.setVolume(0));
mVolumeSeekbar.setMax(100);
mVolumeSeekbar.setOnSeekBarChangeListener(new VolumeSeekBarListener());
/* Volume control buttons */
mVolumeIconButtons = findViewById(R.id.volume_icon_buttons);
mVolumeIconButtons.setOnClickListener(view -> MPDCommandHandler.setVolume(0));
mVolumeText = findViewById(R.id.volume_button_text);
mVolumeMinus = findViewById(R.id.volume_button_minus);
mVolumeMinus.setOnClickListener(v -> MPDCommandHandler.decreaseVolume(mVolumeStepSize));
mVolumePlus = findViewById(R.id.volume_button_plus);
mVolumePlus.setOnClickListener(v -> MPDCommandHandler.increaseVolume(mVolumeStepSize));
/* Create two listeners that start a repeating timer task to repeat the volume plus/minus action */
mPlusListener = new VolumeButtonLongClickListener(VolumeButtonLongClickListener.LISTENER_ACTION.VOLUME_UP, mVolumeStepSize);
mMinusListener = new VolumeButtonLongClickListener(VolumeButtonLongClickListener.LISTENER_ACTION.VOLUME_DOWN, mVolumeStepSize);
/* Set the listener to the plus/minus button */
mVolumeMinus.setOnLongClickListener(mMinusListener);
mVolumeMinus.setOnTouchListener(mMinusListener);
mVolumePlus.setOnLongClickListener(mPlusListener);
mVolumePlus.setOnTouchListener(mPlusListener);
mVolumeSeekbarLayout = findViewById(R.id.volume_seekbar_layout);
mVolumeButtonLayout = findViewById(R.id.volume_button_layout);
mFanartCache = new FanartCacheManager(getApplicationContext());
}
Aggregations