<p>
</p><p>GlobalAction.java内静音模式 </p>
private final class SilentModeTriStateAction implements Action, View.OnClickListener {
private final int[] ITEM_IDS = { R.id.option1, R.id.option2, R.id.option3, R.id.option4 };
private final AudioManager mAudioManager;
private final Handler mHandler;
private final Context mContext;
SilentModeTriStateAction(Context context, AudioManager audioManager, Handler handler) {
mAudioManager = audioManager;
mHandler = handler;
mContext = context;
}
private int indexToRingerMode(int index) {
if (index == 2) {
if (mHasVibrator) {
return AudioManager.RINGER_MODE_VIBRATE;
} else {
return AudioManager.RINGER_MODE_NORMAL;
}
}
return AudioManager.RINGER_MODE_NORMAL;
}
@Override
public CharSequence getLabelForAccessibility(Context context) {
return null;
}
public View create(Context context, View convertView, ViewGroup parent,
LayoutInflater inflater) {
View v = inflater.inflate(R.layout.global_actions_silent_mode, parent, false);
int ringerMode = mAudioManager.getRingerModeInternal();
int zenMode = Global.getInt(mContext.getContentResolver(), Global.ZEN_MODE,
Global.ZEN_MODE_OFF);
int selectedIndex = 0;
if (zenMode != Global.ZEN_MODE_OFF) {
if (zenMode == Global.ZEN_MODE_NO_INTERRUPTIONS) {
selectedIndex = 0;
静音模式
最新推荐文章于 2021-05-27 11:13:17 发布