Skip to content

Commit

Permalink
fixed audio seekbar theme
Browse files Browse the repository at this point in the history
  • Loading branch information
nuclearfog committed Dec 30, 2022
1 parent 107a60b commit f39072c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Build;
Expand Down Expand Up @@ -95,6 +95,11 @@ public class AudioPlayerActivity extends AppCompatActivity implements ServiceCon
*/
private static final int MSG_ID = 0x65059CC4;

/**
* progress thumb drawable transparency mask
*/
private static final int THUMB_TRANSPARENCY = 0x7fffffff;

/**
* The service token
*/
Expand Down Expand Up @@ -644,9 +649,8 @@ private void initPlaybackControls() {
mShuffleButton.setColor(themeColor);
mRepeatButton.setColor(themeColor);
// set seek bar color
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mProgress.setProgressTintList(ColorStateList.valueOf(themeColor));
}
mProgress.getProgressDrawable().setColorFilter(themeColor, PorterDuff.Mode.SRC_IN);
mProgress.getThumb().setColorFilter(themeColor & THUMB_TRANSPARENCY, PorterDuff.Mode.SRC_IN);
}

/**
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/audio_player_controls.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
android:background="@null"
android:layout_marginBottom="@dimen/audio_player_seek_bar_margin_bottom"
android:max="1000"
android:thumb="@null"
app:layout_constraintStart_toEndOf="@id/audio_player_current_time"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/audio_player_controls_barrier"
Expand Down

0 comments on commit f39072c

Please sign in to comment.