mirror of
https://github.com/oxen-io/session-android.git
synced 2023-12-14 02:53:01 +01:00
c36db03a3a
Fixes #6356 Fixes #6406 Fixes #6169 Closes #6800 // FREEBIE
53 lines
1.4 KiB
Java
53 lines
1.4 KiB
Java
package org.thoughtcrime.securesms.components;
|
|
|
|
|
|
import android.content.Context;
|
|
import android.os.Build;
|
|
import android.support.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;
|
|
}
|
|
|
|
}
|