1 package org.lineageos.eleven.widgets;
3 import android.content.Context;
4 import android.text.TextUtils;
5 import android.util.AttributeSet;
6 import android.view.View;
7 import android.view.View.OnClickListener;
8 import android.view.View.OnLongClickListener;
9 import android.widget.ImageButton;
11 import org.lineageos.eleven.R;
12 import org.lineageos.eleven.utils.ApolloUtils;
14 public abstract class AudioButton extends ImageButton implements OnClickListener, OnLongClickListener {
15 public static float ACTIVE_ALPHA = 1.0f;
16 public static float INACTIVE_ALPHA = 0.4f;
18 @SuppressWarnings("deprecation")
19 public AudioButton(final Context context, final AttributeSet attrs) {
20 super(context, attrs);
21 setPadding(0, 0, 0, 0);
22 setBackground(getResources().getDrawable(R.drawable.selectable_background));
23 // Control playback (cycle shuffle)
24 setOnClickListener(this);
25 // Show the cheat sheet
26 setOnLongClickListener(this);
30 public boolean onLongClick(final View view) {
31 if (TextUtils.isEmpty(view.getContentDescription())) {
34 ApolloUtils.showCheatSheet(view);