private void updateProgress(SongDetail mSongDetail) { if (audio_progress != null && mSongDetail != null) { // When SeekBar Dragging Don't Show Progress if (!isDragingStart) { // Progress Value coming in point it range 0 to 1 audio_progress.setValue((int) (mSongDetail.audioProgress * 100)); } String timeString = String.format( "%d:%02d", mSongDetail.audioProgressSec / 60, mSongDetail.audioProgressSec % 60); txt_timeprogress.setText(timeString); } }
// imp private void initSlidingUpPanel() { mLayout = (SlidingUpPanelLayout) findViewById(R.id.sliding_layout); // songAlbumbg = (ImageView) findViewById(R.id.image_songAlbumbg); songAlbumbg = (ImageView) findViewById(R.id.image_songsAlbum); img_bottom_slideone = (ImageView) findViewById(R.id.img_bottom_slideone); img_bottom_slidetwo = (ImageView) findViewById(R.id.img_bottom_slidetwo); txt_timeprogress = (TextView) findViewById(R.id.slidepanel_time_progress); txt_timetotal = (TextView) findViewById(R.id.slidepanel_time_total); imgbtn_backward = (ImageView) findViewById(R.id.btn_backward); imgbtn_forward = (ImageView) findViewById(R.id.btn_forward); imgbtn_toggle = (ImageView) findViewById(R.id.btn_toggle); imgbtn_suffel = (ImageView) findViewById(R.id.btn_suffel); btn_playpause = (PlayPauseView) findViewById(R.id.btn_play); audio_progress = (Slider) findViewById(R.id.audio_progress_control); btn_playpausePanel = (PlayPauseView) findViewById(R.id.bottombar_play); img_Favorite = (ImageView) findViewById(R.id.bottombar_img_Favorite); TypedValue typedvaluecoloraccent = new TypedValue(); getTheme().resolveAttribute(R.attr.colorAccent, typedvaluecoloraccent, true); final int coloraccent = typedvaluecoloraccent.data; audio_progress.setBackgroundColor(coloraccent); audio_progress.setValue(0); audio_progress.setOnValueChangedListener(this); imgbtn_backward.setOnClickListener(this); imgbtn_forward.setOnClickListener(this); imgbtn_toggle.setOnClickListener(this); imgbtn_suffel.setOnClickListener(this); img_Favorite.setOnClickListener(this); btn_playpausePanel.Pause(); btn_playpause.Pause(); txt_playesongname = (TextView) findViewById(R.id.txt_playesongname); txt_songartistname = (TextView) findViewById(R.id.txt_songartistname); txt_playesongname_slidetoptwo = (TextView) findViewById(R.id.txt_playesongname_slidetoptwo); txt_songartistname_slidetoptwo = (TextView) findViewById(R.id.txt_songartistname_slidetoptwo); slidepanelchildtwo_topviewone = (RelativeLayout) findViewById(R.id.slidepanelchildtwo_topviewone); slidepanelchildtwo_topviewtwo = (RelativeLayout) findViewById(R.id.slidepanelchildtwo_topviewtwo); slidepanelchildtwo_topviewone.setVisibility(View.VISIBLE); slidepanelchildtwo_topviewtwo.setVisibility(View.INVISIBLE); slidepanelchildtwo_topviewone.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { mLayout.setPanelState(SlidingUpPanelLayout.PanelState.EXPANDED); } }); slidepanelchildtwo_topviewtwo.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { mLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); } }); ((PlayPauseView) findViewById(R.id.bottombar_play)).setOnClickListener(this); ((PlayPauseView) findViewById(R.id.btn_play)).setOnClickListener(this); mLayout.setPanelSlideListener( new SlidingUpPanelLayout.PanelSlideListener() { @Override public void onPanelSlide(View panel, float slideOffset) { Log.i(TAG, "onPanelSlide, offset " + slideOffset); if (slideOffset == 0.0f) { isExpand = false; slidepanelchildtwo_topviewone.setVisibility(View.VISIBLE); slidepanelchildtwo_topviewtwo.setVisibility(View.INVISIBLE); } else if (slideOffset > 0.0f && slideOffset < 1.0f) { // if (isExpand) { // slidepanelchildtwo_topviewone.setAlpha(1.0f); // slidepanelchildtwo_topviewtwo.setAlpha(1.0f - // slideOffset); // } else { // slidepanelchildtwo_topviewone.setAlpha(1.0f - // slideOffset); // slidepanelchildtwo_topviewtwo.setAlpha(1.0f); // } } else { isExpand = true; slidepanelchildtwo_topviewone.setVisibility(View.INVISIBLE); slidepanelchildtwo_topviewtwo.setVisibility(View.VISIBLE); } } @Override public void onPanelExpanded(View panel) { Log.i(TAG, "onPanelExpanded"); isExpand = true; } @Override public void onPanelCollapsed(View panel) { Log.i(TAG, "onPanelCollapsed"); isExpand = false; } @Override public void onPanelAnchored(View panel) { Log.i(TAG, "onPanelAnchored"); } @Override public void onPanelHidden(View panel) { Log.i(TAG, "onPanelHidden"); } }); }