mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-23 16:37:30 +00:00
54 lines
1.4 KiB
Java
54 lines
1.4 KiB
Java
package org.thoughtcrime.securesms.components;
|
|
|
|
|
|
import android.content.Context;
|
|
import android.os.Build;
|
|
import androidx.annotation.RequiresApi;
|
|
import android.util.AttributeSet;
|
|
import android.widget.ToggleButton;
|
|
|
|
public class AccessibleToggleButton extends ToggleButton {
|
|
|
|
private OnCheckedChangeListener listener;
|
|
|
|
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
|
public AccessibleToggleButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
|
super(context, attrs, defStyleAttr, defStyleRes);
|
|
}
|
|
|
|
public AccessibleToggleButton(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
super(context, attrs, defStyleAttr);
|
|
}
|
|
|
|
public AccessibleToggleButton(Context context, AttributeSet attrs) {
|
|
super(context, attrs);
|
|
}
|
|
|
|
public AccessibleToggleButton(Context context) {
|
|
super(context);
|
|
}
|
|
|
|
@Override
|
|
public void setOnCheckedChangeListener(OnCheckedChangeListener listener) {
|
|
super.setOnCheckedChangeListener(listener);
|
|
this.listener = listener;
|
|
}
|
|
|
|
public void setChecked(boolean checked, boolean notifyListener) {
|
|
if (!notifyListener) {
|
|
super.setOnCheckedChangeListener(null);
|
|
}
|
|
|
|
super.setChecked(checked);
|
|
|
|
if (!notifyListener) {
|
|
super.setOnCheckedChangeListener(listener);
|
|
}
|
|
}
|
|
|
|
public OnCheckedChangeListener getOnCheckedChangeListener() {
|
|
return this.listener;
|
|
}
|
|
|
|
}
|