Example usage for android.os Bundle getBoolean

List of usage examples for android.os Bundle getBoolean

Introduction

In this page you can find the example usage for android.os Bundle getBoolean.

Prototype

public boolean getBoolean(String key, boolean defaultValue) 

Source Link

Document

Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key.

Usage

From source file:br.com.thinkti.android.filechooserfrag.fragFileChooser.java

public void init() {
    if (_main == null || _Intent == null || _chooserView == null || _blnInitialized) {
        return;/*ww  w .  j av a2  s.com*/
    }
    try {
        Bundle extras = _Intent.getExtras();
        if (extras != null) {
            unicode = extras.getBoolean("blnUniCode", true);
            DefaultDir = extras.getString("DefaultDir");
            if (extras.getStringArrayList("filterFileExtension") != null) {
                extensions = extras.getStringArrayList("filterFileExtension");
                fileFilter = new FileFilter() {
                    @Override
                    public boolean accept(File pathname) {
                        return ((pathname.isDirectory()) || ExtensionsMatch(pathname));
                    }
                };
            }
        }

        setCurrentDir((DefaultDir));
        _blnInitialized = true;
    } catch (Exception ex) {
        Toast.makeText(_main, _main.getString(R.string.Error) + ex.getMessage(), Toast.LENGTH_LONG).show();
    }
}

From source file:cn.ucai.yizhesale.activity.SettingsFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false))
        return;/*from w  w  w  .j  a  v  a2 s  .c  o m*/
    rl_switch_notification = (RelativeLayout) getView()
            .findViewById(cn.ucai.yizhesale.R.id.rl_switch_notification);
    rl_switch_sound = (RelativeLayout) getView().findViewById(cn.ucai.yizhesale.R.id.rl_switch_sound);
    rl_switch_vibrate = (RelativeLayout) getView().findViewById(cn.ucai.yizhesale.R.id.rl_switch_vibrate);
    rl_switch_speaker = (RelativeLayout) getView().findViewById(cn.ucai.yizhesale.R.id.rl_switch_speaker);
    rl_switch_chatroom_leave = (RelativeLayout) getView()
            .findViewById(cn.ucai.yizhesale.R.id.rl_switch_chatroom_owner_leave);

    iv_switch_open_notification = (ImageView) getView()
            .findViewById(cn.ucai.yizhesale.R.id.iv_switch_open_notification);
    iv_switch_close_notification = (ImageView) getView()
            .findViewById(cn.ucai.yizhesale.R.id.iv_switch_close_notification);
    iv_switch_open_sound = (ImageView) getView().findViewById(cn.ucai.yizhesale.R.id.iv_switch_open_sound);
    iv_switch_close_sound = (ImageView) getView().findViewById(cn.ucai.yizhesale.R.id.iv_switch_close_sound);
    iv_switch_open_vibrate = (ImageView) getView().findViewById(cn.ucai.yizhesale.R.id.iv_switch_open_vibrate);
    iv_switch_close_vibrate = (ImageView) getView()
            .findViewById(cn.ucai.yizhesale.R.id.iv_switch_close_vibrate);
    iv_switch_open_speaker = (ImageView) getView().findViewById(cn.ucai.yizhesale.R.id.iv_switch_open_speaker);
    iv_switch_close_speaker = (ImageView) getView()
            .findViewById(cn.ucai.yizhesale.R.id.iv_switch_close_speaker);

    iv_switch_room_owner_leave_allow = (ImageView) getView()
            .findViewById(cn.ucai.yizhesale.R.id.iv_switch_chatroom_owner_leave_allow);
    iv_switch_room_owner_leave_disallow = (ImageView) getView()
            .findViewById(cn.ucai.yizhesale.R.id.iv_switch_chatroom_owner_leave_not_allow);

    logoutBtn = (Button) getView().findViewById(cn.ucai.yizhesale.R.id.btn_logout);
    if (!TextUtils.isEmpty(EMChatManager.getInstance().getCurrentUser())) {
        logoutBtn.setText(getString(cn.ucai.yizhesale.R.string.button_logout) + "("
                + EMChatManager.getInstance().getCurrentUser() + ")");
    }

    textview1 = (TextView) getView().findViewById(cn.ucai.yizhesale.R.id.textview1);
    textview2 = (TextView) getView().findViewById(cn.ucai.yizhesale.R.id.textview2);

    blacklistContainer = (LinearLayout) getView().findViewById(cn.ucai.yizhesale.R.id.ll_black_list);
    userProfileContainer = (LinearLayout) getView().findViewById(cn.ucai.yizhesale.R.id.ll_user_profile);
    llDiagnose = (LinearLayout) getView().findViewById(cn.ucai.yizhesale.R.id.ll_diagnose);
    pushNick = (LinearLayout) getView().findViewById(cn.ucai.yizhesale.R.id.ll_set_push_nick);

    blacklistContainer.setOnClickListener(this);
    userProfileContainer.setOnClickListener(this);
    rl_switch_notification.setOnClickListener(this);
    rl_switch_sound.setOnClickListener(this);
    rl_switch_vibrate.setOnClickListener(this);
    rl_switch_speaker.setOnClickListener(this);
    logoutBtn.setOnClickListener(this);
    llDiagnose.setOnClickListener(this);
    pushNick.setOnClickListener(this);
    rl_switch_chatroom_leave.setOnClickListener(this);

    chatOptions = EMChatManager.getInstance().getChatOptions();

    model = (DemoHXSDKModel) HXSDKHelper.getInstance().getModel();

    // ????
    // the vibrate and sound notification are allowed or not?
    if (model.getSettingMsgNotification()) {
        iv_switch_open_notification.setVisibility(View.VISIBLE);
        iv_switch_close_notification.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_notification.setVisibility(View.INVISIBLE);
        iv_switch_close_notification.setVisibility(View.VISIBLE);
    }

    // ?
    // sound notification is switched on or not?
    if (model.getSettingMsgSound()) {
        iv_switch_open_sound.setVisibility(View.VISIBLE);
        iv_switch_close_sound.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_sound.setVisibility(View.INVISIBLE);
        iv_switch_close_sound.setVisibility(View.VISIBLE);
    }

    // ?
    // vibrate notification is switched on or not?
    if (model.getSettingMsgVibrate()) {
        iv_switch_open_vibrate.setVisibility(View.VISIBLE);
        iv_switch_close_vibrate.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_vibrate.setVisibility(View.INVISIBLE);
        iv_switch_close_vibrate.setVisibility(View.VISIBLE);
    }

    // ?
    // the speaker is switched on or not?
    if (model.getSettingMsgSpeaker()) {
        iv_switch_open_speaker.setVisibility(View.VISIBLE);
        iv_switch_close_speaker.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_speaker.setVisibility(View.INVISIBLE);
        iv_switch_close_speaker.setVisibility(View.VISIBLE);
    }

    // ???owner leave
    if (model.isChatroomOwnerLeaveAllowed()) {
        iv_switch_room_owner_leave_allow.setVisibility(View.VISIBLE);
        iv_switch_room_owner_leave_disallow.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_room_owner_leave_allow.setVisibility(View.INVISIBLE);
        iv_switch_room_owner_leave_disallow.setVisibility(View.VISIBLE);
    }
}

From source file:cn.xcom.helper.chat.ui.SettingsFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false))
        return;//from www  .ja  va 2  s .  c  o m
    rl_switch_notification = (RelativeLayout) getView().findViewById(R.id.rl_switch_notification);
    rl_switch_sound = (RelativeLayout) getView().findViewById(R.id.rl_switch_sound);
    rl_switch_vibrate = (RelativeLayout) getView().findViewById(R.id.rl_switch_vibrate);
    rl_switch_speaker = (RelativeLayout) getView().findViewById(R.id.rl_switch_speaker);
    rl_switch_chatroom_leave = (RelativeLayout) getView().findViewById(R.id.rl_switch_chatroom_owner_leave);
    rl_switch_delete_msg_when_exit_group = (RelativeLayout) getView()
            .findViewById(R.id.rl_switch_delete_msg_when_exit_group);
    rl_switch_auto_accept_group_invitation = (RelativeLayout) getView()
            .findViewById(R.id.rl_switch_auto_accept_group_invitation);
    rl_switch_adaptive_video_encode = (RelativeLayout) getView()
            .findViewById(R.id.rl_switch_adaptive_video_encode);

    notifiSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_notification);
    soundSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_sound);
    vibrateSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_vibrate);
    speakerSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_speaker);
    ownerLeaveSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_owner_leave);
    switch_delete_msg_when_exit_group = (EaseSwitchButton) getView()
            .findViewById(R.id.switch_delete_msg_when_exit_group);
    switch_auto_accept_group_invitation = (EaseSwitchButton) getView()
            .findViewById(R.id.switch_auto_accept_group_invitation);
    switch_adaptive_video_encode = (EaseSwitchButton) getView().findViewById(R.id.switch_adaptive_video_encode);
    LinearLayout llChange = (LinearLayout) getView().findViewById(R.id.ll_change);
    logoutBtn = (Button) getView().findViewById(R.id.btn_logout);
    if (!TextUtils.isEmpty(EMClient.getInstance().getCurrentUser())) {
        logoutBtn.setText(
                getString(R.string.button_logout) + "(" + EMClient.getInstance().getCurrentUser() + ")");
    }

    textview1 = (TextView) getView().findViewById(R.id.textview1);
    textview2 = (TextView) getView().findViewById(R.id.textview2);

    blacklistContainer = (LinearLayout) getView().findViewById(R.id.ll_black_list);
    userProfileContainer = (LinearLayout) getView().findViewById(R.id.ll_user_profile);
    llDiagnose = (LinearLayout) getView().findViewById(R.id.ll_diagnose);
    pushNick = (LinearLayout) getView().findViewById(R.id.ll_set_push_nick);

    settingsModel = DemoHelper.getInstance().getModel();
    chatOptions = EMClient.getInstance().getOptions();

    blacklistContainer.setOnClickListener(this);
    userProfileContainer.setOnClickListener(this);
    rl_switch_notification.setOnClickListener(this);
    rl_switch_sound.setOnClickListener(this);
    rl_switch_vibrate.setOnClickListener(this);
    rl_switch_speaker.setOnClickListener(this);
    logoutBtn.setOnClickListener(this);
    llDiagnose.setOnClickListener(this);
    pushNick.setOnClickListener(this);
    rl_switch_chatroom_leave.setOnClickListener(this);
    rl_switch_delete_msg_when_exit_group.setOnClickListener(this);
    rl_switch_auto_accept_group_invitation.setOnClickListener(this);
    rl_switch_adaptive_video_encode.setOnClickListener(this);
    llChange.setOnClickListener(this);

    // the vibrate and sound notification are allowed or not?
    if (settingsModel.getSettingMsgNotification()) {
        notifiSwitch.openSwitch();
    } else {
        notifiSwitch.closeSwitch();
    }

    // sound notification is switched on or not?
    if (settingsModel.getSettingMsgSound()) {
        soundSwitch.openSwitch();
    } else {
        soundSwitch.closeSwitch();
    }

    // vibrate notification is switched on or not?
    if (settingsModel.getSettingMsgVibrate()) {
        vibrateSwitch.openSwitch();
    } else {
        vibrateSwitch.closeSwitch();
    }

    // the speaker is switched on or not?
    if (settingsModel.getSettingMsgSpeaker()) {
        speakerSwitch.openSwitch();
    } else {
        speakerSwitch.closeSwitch();
    }

    // if allow owner leave
    if (settingsModel.isChatroomOwnerLeaveAllowed()) {
        ownerLeaveSwitch.openSwitch();
    } else {
        ownerLeaveSwitch.closeSwitch();
    }

    // delete messages when exit group?
    if (settingsModel.isDeleteMessagesAsExitGroup()) {
        switch_delete_msg_when_exit_group.openSwitch();
    } else {
        switch_delete_msg_when_exit_group.closeSwitch();
    }

    if (settingsModel.isAutoAcceptGroupInvitation()) {
        switch_auto_accept_group_invitation.openSwitch();
    } else {
        switch_auto_accept_group_invitation.closeSwitch();
    }

    if (settingsModel.isAdaptiveVideoEncode()) {
        switch_adaptive_video_encode.openSwitch();
        EMClient.getInstance().callManager().getVideoCallHelper().setAdaptiveVideoFlag(true);
    } else {
        switch_adaptive_video_encode.closeSwitch();
        EMClient.getInstance().callManager().getVideoCallHelper().setAdaptiveVideoFlag(false);
    }
}

From source file:cn.hbm.superwechat.activity.SettingsFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false))
        return;// ww  w  .j  ava2 s  . c o m
    rl_switch_notification = (RelativeLayout) getView().findViewById(R.id.rl_switch_notification);
    rl_switch_sound = (RelativeLayout) getView().findViewById(R.id.rl_switch_sound);
    rl_switch_vibrate = (RelativeLayout) getView().findViewById(R.id.rl_switch_vibrate);
    rl_switch_speaker = (RelativeLayout) getView().findViewById(R.id.rl_switch_speaker);
    rl_switch_chatroom_leave = (RelativeLayout) getView().findViewById(R.id.rl_switch_chatroom_owner_leave);

    iv_switch_open_notification = (ImageView) getView().findViewById(R.id.iv_switch_open_notification);
    iv_switch_close_notification = (ImageView) getView().findViewById(R.id.iv_switch_close_notification);
    iv_switch_open_sound = (ImageView) getView().findViewById(R.id.iv_switch_open_sound);
    iv_switch_close_sound = (ImageView) getView().findViewById(R.id.iv_switch_close_sound);
    iv_switch_open_vibrate = (ImageView) getView().findViewById(R.id.iv_switch_open_vibrate);
    iv_switch_close_vibrate = (ImageView) getView().findViewById(R.id.iv_switch_close_vibrate);
    iv_switch_open_speaker = (ImageView) getView().findViewById(R.id.iv_switch_open_speaker);
    iv_switch_close_speaker = (ImageView) getView().findViewById(R.id.iv_switch_close_speaker);

    iv_switch_room_owner_leave_allow = (ImageView) getView()
            .findViewById(R.id.iv_switch_chatroom_owner_leave_allow);
    iv_switch_room_owner_leave_disallow = (ImageView) getView()
            .findViewById(R.id.iv_switch_chatroom_owner_leave_not_allow);

    logoutBtn = (Button) getView().findViewById(R.id.btn_logout);
    if (!TextUtils.isEmpty(EMChatManager.getInstance().getCurrentUser())) {
        logoutBtn.setText(
                getString(R.string.button_logout) + "(" + EMChatManager.getInstance().getCurrentUser() + ")");
    }

    textview1 = (TextView) getView().findViewById(R.id.textview1);
    textview2 = (TextView) getView().findViewById(R.id.textview2);

    blacklistContainer = (LinearLayout) getView().findViewById(R.id.ll_black_list);
    userProfileContainer = (LinearLayout) getView().findViewById(R.id.ll_user_profile);
    llDiagnose = (LinearLayout) getView().findViewById(R.id.ll_diagnose);
    pushNick = (LinearLayout) getView().findViewById(R.id.ll_set_push_nick);

    blacklistContainer.setOnClickListener(this);
    userProfileContainer.setOnClickListener(this);
    rl_switch_notification.setOnClickListener(this);
    rl_switch_sound.setOnClickListener(this);
    rl_switch_vibrate.setOnClickListener(this);
    rl_switch_speaker.setOnClickListener(this);
    logoutBtn.setOnClickListener(this);
    llDiagnose.setOnClickListener(this);
    pushNick.setOnClickListener(this);
    rl_switch_chatroom_leave.setOnClickListener(this);

    chatOptions = EMChatManager.getInstance().getChatOptions();

    model = (DemoHXSDKModel) HXSDKHelper.getInstance().getModel();

    // ????
    // the vibrate and sound notification are allowed or not?
    if (model.getSettingMsgNotification()) {
        iv_switch_open_notification.setVisibility(View.VISIBLE);
        iv_switch_close_notification.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_notification.setVisibility(View.INVISIBLE);
        iv_switch_close_notification.setVisibility(View.VISIBLE);
    }

    // ?
    // sound notification is switched on or not?
    if (model.getSettingMsgSound()) {
        iv_switch_open_sound.setVisibility(View.VISIBLE);
        iv_switch_close_sound.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_sound.setVisibility(View.INVISIBLE);
        iv_switch_close_sound.setVisibility(View.VISIBLE);
    }

    // ?
    // vibrate notification is switched on or not?
    if (model.getSettingMsgVibrate()) {
        iv_switch_open_vibrate.setVisibility(View.VISIBLE);
        iv_switch_close_vibrate.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_vibrate.setVisibility(View.INVISIBLE);
        iv_switch_close_vibrate.setVisibility(View.VISIBLE);
    }

    // ?
    // the speaker is switched on or not?
    if (model.getSettingMsgSpeaker()) {
        iv_switch_open_speaker.setVisibility(View.VISIBLE);
        iv_switch_close_speaker.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_speaker.setVisibility(View.INVISIBLE);
        iv_switch_close_speaker.setVisibility(View.VISIBLE);
    }

    // ???owner leave
    if (model.isChatroomOwnerLeaveAllowed()) {
        iv_switch_room_owner_leave_allow.setVisibility(View.VISIBLE);
        iv_switch_room_owner_leave_disallow.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_room_owner_leave_allow.setVisibility(View.INVISIBLE);
        iv_switch_room_owner_leave_disallow.setVisibility(View.VISIBLE);
    }
}

From source file:cn.ucai.superwechat.fragment.SettingsFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false))
        return;//  w  w  w .java2s .  c  o  m
    rl_switch_notification = (RelativeLayout) getView()
            .findViewById(cn.ucai.superwechat.R.id.rl_switch_notification);
    rl_switch_sound = (RelativeLayout) getView().findViewById(cn.ucai.superwechat.R.id.rl_switch_sound);
    rl_switch_vibrate = (RelativeLayout) getView().findViewById(cn.ucai.superwechat.R.id.rl_switch_vibrate);
    rl_switch_speaker = (RelativeLayout) getView().findViewById(cn.ucai.superwechat.R.id.rl_switch_speaker);
    rl_switch_chatroom_leave = (RelativeLayout) getView()
            .findViewById(cn.ucai.superwechat.R.id.rl_switch_chatroom_owner_leave);

    iv_switch_open_notification = (ImageView) getView()
            .findViewById(cn.ucai.superwechat.R.id.iv_switch_open_notification);
    iv_switch_close_notification = (ImageView) getView()
            .findViewById(cn.ucai.superwechat.R.id.iv_switch_close_notification);
    iv_switch_open_sound = (ImageView) getView().findViewById(cn.ucai.superwechat.R.id.iv_switch_open_sound);
    iv_switch_close_sound = (ImageView) getView().findViewById(cn.ucai.superwechat.R.id.iv_switch_close_sound);
    iv_switch_open_vibrate = (ImageView) getView()
            .findViewById(cn.ucai.superwechat.R.id.iv_switch_open_vibrate);
    iv_switch_close_vibrate = (ImageView) getView()
            .findViewById(cn.ucai.superwechat.R.id.iv_switch_close_vibrate);
    iv_switch_open_speaker = (ImageView) getView()
            .findViewById(cn.ucai.superwechat.R.id.iv_switch_open_speaker);
    iv_switch_close_speaker = (ImageView) getView()
            .findViewById(cn.ucai.superwechat.R.id.iv_switch_close_speaker);

    iv_switch_room_owner_leave_allow = (ImageView) getView()
            .findViewById(cn.ucai.superwechat.R.id.iv_switch_chatroom_owner_leave_allow);
    iv_switch_room_owner_leave_disallow = (ImageView) getView()
            .findViewById(cn.ucai.superwechat.R.id.iv_switch_chatroom_owner_leave_not_allow);

    logoutBtn = (Button) getView().findViewById(cn.ucai.superwechat.R.id.btn_logout);
    if (!TextUtils.isEmpty(EMChatManager.getInstance().getCurrentUser())) {
        logoutBtn.setText(getString(cn.ucai.superwechat.R.string.button_logout) + "("
                + EMChatManager.getInstance().getCurrentUser() + ")");
    }

    textview1 = (TextView) getView().findViewById(cn.ucai.superwechat.R.id.textview1);
    textview2 = (TextView) getView().findViewById(cn.ucai.superwechat.R.id.textview2);

    blacklistContainer = (LinearLayout) getView().findViewById(cn.ucai.superwechat.R.id.ll_black_list);
    userProfileContainer = (LinearLayout) getView().findViewById(cn.ucai.superwechat.R.id.ll_user_profile);
    llDiagnose = (LinearLayout) getView().findViewById(cn.ucai.superwechat.R.id.ll_diagnose);
    pushNick = (LinearLayout) getView().findViewById(cn.ucai.superwechat.R.id.ll_set_push_nick);

    blacklistContainer.setOnClickListener(this);
    userProfileContainer.setOnClickListener(this);
    rl_switch_notification.setOnClickListener(this);
    rl_switch_sound.setOnClickListener(this);
    rl_switch_vibrate.setOnClickListener(this);
    rl_switch_speaker.setOnClickListener(this);
    logoutBtn.setOnClickListener(this);
    llDiagnose.setOnClickListener(this);
    pushNick.setOnClickListener(this);
    rl_switch_chatroom_leave.setOnClickListener(this);

    chatOptions = EMChatManager.getInstance().getChatOptions();

    model = (DemoHXSDKModel) HXSDKHelper.getInstance().getModel();

    // ????
    // the vibrate and sound notification are allowed or not?
    if (model.getSettingMsgNotification()) {
        iv_switch_open_notification.setVisibility(View.VISIBLE);
        iv_switch_close_notification.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_notification.setVisibility(View.INVISIBLE);
        iv_switch_close_notification.setVisibility(View.VISIBLE);
    }

    // ?
    // sound notification is switched on or not?
    if (model.getSettingMsgSound()) {
        iv_switch_open_sound.setVisibility(View.VISIBLE);
        iv_switch_close_sound.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_sound.setVisibility(View.INVISIBLE);
        iv_switch_close_sound.setVisibility(View.VISIBLE);
    }

    // ?
    // vibrate notification is switched on or not?
    if (model.getSettingMsgVibrate()) {
        iv_switch_open_vibrate.setVisibility(View.VISIBLE);
        iv_switch_close_vibrate.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_vibrate.setVisibility(View.INVISIBLE);
        iv_switch_close_vibrate.setVisibility(View.VISIBLE);
    }

    // ?
    // the speaker is switched on or not?
    if (model.getSettingMsgSpeaker()) {
        iv_switch_open_speaker.setVisibility(View.VISIBLE);
        iv_switch_close_speaker.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_speaker.setVisibility(View.INVISIBLE);
        iv_switch_close_speaker.setVisibility(View.VISIBLE);
    }

    // ???owner leave
    if (model.isChatroomOwnerLeaveAllowed()) {
        iv_switch_room_owner_leave_allow.setVisibility(View.VISIBLE);
        iv_switch_room_owner_leave_disallow.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_room_owner_leave_allow.setVisibility(View.INVISIBLE);
        iv_switch_room_owner_leave_disallow.setVisibility(View.VISIBLE);
    }
}

From source file:com.aibasis.parent.ui.setting.SettingsFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false))
        return;/*from   w ww  .  j  a v a 2  s  .  c om*/
    rl_switch_notification = (RelativeLayout) getView().findViewById(R.id.rl_switch_notification);
    rl_switch_sound = (RelativeLayout) getView().findViewById(R.id.rl_switch_sound);
    rl_switch_vibrate = (RelativeLayout) getView().findViewById(R.id.rl_switch_vibrate);
    rl_switch_speaker = (RelativeLayout) getView().findViewById(R.id.rl_switch_speaker);
    rl_switch_chatroom_leave = (RelativeLayout) getView().findViewById(R.id.rl_switch_chatroom_owner_leave);

    iv_switch_open_notification = (ImageView) getView().findViewById(R.id.iv_switch_open_notification);
    iv_switch_close_notification = (ImageView) getView().findViewById(R.id.iv_switch_close_notification);
    iv_switch_open_sound = (ImageView) getView().findViewById(R.id.iv_switch_open_sound);
    iv_switch_close_sound = (ImageView) getView().findViewById(R.id.iv_switch_close_sound);
    iv_switch_open_vibrate = (ImageView) getView().findViewById(R.id.iv_switch_open_vibrate);
    iv_switch_close_vibrate = (ImageView) getView().findViewById(R.id.iv_switch_close_vibrate);
    iv_switch_open_speaker = (ImageView) getView().findViewById(R.id.iv_switch_open_speaker);
    iv_switch_close_speaker = (ImageView) getView().findViewById(R.id.iv_switch_close_speaker);

    iv_switch_room_owner_leave_allow = (ImageView) getView()
            .findViewById(R.id.iv_switch_chatroom_owner_leave_allow);
    iv_switch_room_owner_leave_disallow = (ImageView) getView()
            .findViewById(R.id.iv_switch_chatroom_owner_leave_not_allow);

    logoutBtn = (Button) getView().findViewById(R.id.btn_logout);
    if (!TextUtils.isEmpty(EMChatManager.getInstance().getCurrentUser())) {
        logoutBtn.setText(
                getString(R.string.button_logout) + "(" + EMChatManager.getInstance().getCurrentUser() + ")");
    }

    textview1 = (TextView) getView().findViewById(R.id.textview1);
    textview2 = (TextView) getView().findViewById(R.id.textview2);

    blacklistContainer = (LinearLayout) getView().findViewById(R.id.ll_black_list);
    userProfileContainer = (LinearLayout) getView().findViewById(R.id.ll_user_profile);
    llDiagnose = (LinearLayout) getView().findViewById(R.id.ll_diagnose);
    llBind = (LinearLayout) getView().findViewById(R.id.ll_bind);

    pushNick = (LinearLayout) getView().findViewById(R.id.ll_set_push_nick);

    blacklistContainer.setOnClickListener(this);
    userProfileContainer.setOnClickListener(this);
    rl_switch_notification.setOnClickListener(this);
    rl_switch_sound.setOnClickListener(this);
    rl_switch_vibrate.setOnClickListener(this);
    rl_switch_speaker.setOnClickListener(this);
    logoutBtn.setOnClickListener(this);
    llDiagnose.setOnClickListener(this);
    llBind.setOnClickListener(this);

    pushNick.setOnClickListener(this);
    rl_switch_chatroom_leave.setOnClickListener(this);

    chatOptions = EMChatManager.getInstance().getChatOptions();

    model = (DemoHXSDKModel) HXSDKHelper.getInstance().getModel();

    // ????
    // the vibrate and sound notification are allowed or not?
    if (model.getSettingMsgNotification()) {
        iv_switch_open_notification.setVisibility(View.VISIBLE);
        iv_switch_close_notification.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_notification.setVisibility(View.INVISIBLE);
        iv_switch_close_notification.setVisibility(View.VISIBLE);
    }

    // ?
    // sound notification is switched on or not?
    if (model.getSettingMsgSound()) {
        iv_switch_open_sound.setVisibility(View.VISIBLE);
        iv_switch_close_sound.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_sound.setVisibility(View.INVISIBLE);
        iv_switch_close_sound.setVisibility(View.VISIBLE);
    }

    // ?
    // vibrate notification is switched on or not?
    if (model.getSettingMsgVibrate()) {
        iv_switch_open_vibrate.setVisibility(View.VISIBLE);
        iv_switch_close_vibrate.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_vibrate.setVisibility(View.INVISIBLE);
        iv_switch_close_vibrate.setVisibility(View.VISIBLE);
    }

    // ?
    // the speaker is switched on or not?
    if (model.getSettingMsgSpeaker()) {
        iv_switch_open_speaker.setVisibility(View.VISIBLE);
        iv_switch_close_speaker.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_speaker.setVisibility(View.INVISIBLE);
        iv_switch_close_speaker.setVisibility(View.VISIBLE);
    }

    // ???owner leave
    if (model.isChatroomOwnerLeaveAllowed()) {
        iv_switch_room_owner_leave_allow.setVisibility(View.VISIBLE);
        iv_switch_room_owner_leave_disallow.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_room_owner_leave_allow.setVisibility(View.INVISIBLE);
        iv_switch_room_owner_leave_disallow.setVisibility(View.VISIBLE);
    }
}

From source file:com.allandroidprojects.ecomsample.fragments.ViewPagerActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_pager);
    mViewPager = (HackyViewPager) findViewById(R.id.view_pager);
    setContentView(mViewPager);//w  w  w . j  av a  2  s. c o m

    mViewPager.setAdapter(new SamplePagerAdapter());
    if (getIntent() != null) {
        position = getIntent().getIntExtra("position", 0);
        mViewPager.setCurrentItem(position);
    }

    if (savedInstanceState != null) {
        boolean isLocked = savedInstanceState.getBoolean(ISLOCKED_ARG, false);
        ((HackyViewPager) mViewPager).setLocked(isLocked);
    }

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT)
        return;
    getWindow().getDecorView()
            .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}

From source file:com.abroad.ruianju.im.ui.SettingsFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false))
        return;/*from   w w  w  . java 2  s.  c  om*/
    rl_switch_notification = (RelativeLayout) getView().findViewById(R.id.rl_switch_notification);
    rl_switch_sound = (RelativeLayout) getView().findViewById(R.id.rl_switch_sound);
    rl_switch_vibrate = (RelativeLayout) getView().findViewById(R.id.rl_switch_vibrate);
    rl_switch_speaker = (RelativeLayout) getView().findViewById(R.id.rl_switch_speaker);
    rl_switch_chatroom_leave = (RelativeLayout) getView().findViewById(R.id.rl_switch_chatroom_owner_leave);
    rl_switch_delete_msg_when_exit_group = (RelativeLayout) getView()
            .findViewById(R.id.rl_switch_delete_msg_when_exit_group);
    rl_switch_auto_accept_group_invitation = (RelativeLayout) getView()
            .findViewById(R.id.rl_switch_auto_accept_group_invitation);
    rl_switch_adaptive_video_encode = (RelativeLayout) getView()
            .findViewById(R.id.rl_switch_adaptive_video_encode);
    rl_custom_server = (RelativeLayout) getView().findViewById(R.id.rl_custom_server);

    notifiSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_notification);
    soundSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_sound);
    vibrateSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_vibrate);
    speakerSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_speaker);
    ownerLeaveSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_owner_leave);
    switch_delete_msg_when_exit_group = (EaseSwitchButton) getView()
            .findViewById(R.id.switch_delete_msg_when_exit_group);
    switch_auto_accept_group_invitation = (EaseSwitchButton) getView()
            .findViewById(R.id.switch_auto_accept_group_invitation);
    switch_adaptive_video_encode = (EaseSwitchButton) getView().findViewById(R.id.switch_adaptive_video_encode);
    LinearLayout llChange = (LinearLayout) getView().findViewById(R.id.ll_change);
    logoutBtn = (Button) getView().findViewById(R.id.btn_logout);
    if (!TextUtils.isEmpty(EMClient.getInstance().getCurrentUser())) {
        logoutBtn.setText(
                getString(R.string.button_logout) + "(" + EMClient.getInstance().getCurrentUser() + ")");
    }
    customServerSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_custom_server);

    textview1 = (TextView) getView().findViewById(R.id.textview1);
    textview2 = (TextView) getView().findViewById(R.id.textview2);

    blacklistContainer = (LinearLayout) getView().findViewById(R.id.ll_black_list);
    userProfileContainer = (LinearLayout) getView().findViewById(R.id.ll_user_profile);
    llDiagnose = (LinearLayout) getView().findViewById(R.id.ll_diagnose);
    pushNick = (LinearLayout) getView().findViewById(R.id.ll_set_push_nick);

    settingsModel = DemoHelper.getInstance().getModel();
    chatOptions = EMClient.getInstance().getOptions();

    blacklistContainer.setOnClickListener(this);
    userProfileContainer.setOnClickListener(this);
    rl_switch_notification.setOnClickListener(this);
    rl_switch_sound.setOnClickListener(this);
    rl_switch_vibrate.setOnClickListener(this);
    rl_switch_speaker.setOnClickListener(this);
    customServerSwitch.setOnClickListener(this);
    rl_custom_server.setOnClickListener(this);
    logoutBtn.setOnClickListener(this);
    llDiagnose.setOnClickListener(this);
    pushNick.setOnClickListener(this);
    rl_switch_chatroom_leave.setOnClickListener(this);
    rl_switch_delete_msg_when_exit_group.setOnClickListener(this);
    rl_switch_auto_accept_group_invitation.setOnClickListener(this);
    rl_switch_adaptive_video_encode.setOnClickListener(this);
    llChange.setOnClickListener(this);

    // the vibrate and sound notification are allowed or not?
    if (settingsModel.getSettingMsgNotification()) {
        notifiSwitch.openSwitch();
    } else {
        notifiSwitch.closeSwitch();
    }

    // sound notification is switched on or not?
    if (settingsModel.getSettingMsgSound()) {
        soundSwitch.openSwitch();
    } else {
        soundSwitch.closeSwitch();
    }

    // vibrate notification is switched on or not?
    if (settingsModel.getSettingMsgVibrate()) {
        vibrateSwitch.openSwitch();
    } else {
        vibrateSwitch.closeSwitch();
    }

    // the speaker is switched on or not?
    if (settingsModel.getSettingMsgSpeaker()) {
        speakerSwitch.openSwitch();
    } else {
        speakerSwitch.closeSwitch();
    }

    // if allow owner leave
    if (settingsModel.isChatroomOwnerLeaveAllowed()) {
        ownerLeaveSwitch.openSwitch();
    } else {
        ownerLeaveSwitch.closeSwitch();
    }

    // delete messages when exit group?
    if (settingsModel.isDeleteMessagesAsExitGroup()) {
        switch_delete_msg_when_exit_group.openSwitch();
    } else {
        switch_delete_msg_when_exit_group.closeSwitch();
    }

    if (settingsModel.isAutoAcceptGroupInvitation()) {
        switch_auto_accept_group_invitation.openSwitch();
    } else {
        switch_auto_accept_group_invitation.closeSwitch();
    }

    if (settingsModel.isAdaptiveVideoEncode()) {
        switch_adaptive_video_encode.openSwitch();
        EMClient.getInstance().callManager().getVideoCallHelper().setAdaptiveVideoFlag(true);
    } else {
        switch_adaptive_video_encode.closeSwitch();
        EMClient.getInstance().callManager().getVideoCallHelper().setAdaptiveVideoFlag(false);
    }

    if (settingsModel.isCustomServerEnable()) {
        customServerSwitch.openSwitch();
    } else {
        customServerSwitch.closeSwitch();
    }
}

From source file:cn.ucai.superwechat.ui.SettingsFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false))
        return;//w  w  w.j  a v a  2 s. co m
    rl_switch_notification = (RelativeLayout) getView().findViewById(R.id.rl_switch_notification);
    rl_switch_sound = (RelativeLayout) getView().findViewById(R.id.rl_switch_sound);
    rl_switch_vibrate = (RelativeLayout) getView().findViewById(R.id.rl_switch_vibrate);
    rl_switch_speaker = (RelativeLayout) getView().findViewById(R.id.rl_switch_speaker);
    rl_switch_chatroom_leave = (RelativeLayout) getView().findViewById(R.id.rl_switch_chatroom_owner_leave);
    rl_switch_delete_msg_when_exit_group = (RelativeLayout) getView()
            .findViewById(R.id.rl_switch_delete_msg_when_exit_group);
    rl_switch_auto_accept_group_invitation = (RelativeLayout) getView()
            .findViewById(R.id.rl_switch_auto_accept_group_invitation);
    rl_switch_adaptive_video_encode = (RelativeLayout) getView()
            .findViewById(R.id.rl_switch_adaptive_video_encode);
    rl_custom_server = (RelativeLayout) getView().findViewById(R.id.rl_custom_server);

    notifiSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_notification);
    soundSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_sound);
    vibrateSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_vibrate);
    speakerSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_speaker);
    ownerLeaveSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_owner_leave);
    switch_delete_msg_when_exit_group = (EaseSwitchButton) getView()
            .findViewById(R.id.switch_delete_msg_when_exit_group);
    switch_auto_accept_group_invitation = (EaseSwitchButton) getView()
            .findViewById(R.id.switch_auto_accept_group_invitation);
    switch_adaptive_video_encode = (EaseSwitchButton) getView().findViewById(R.id.switch_adaptive_video_encode);
    LinearLayout llChange = (LinearLayout) getView().findViewById(R.id.ll_change);
    logoutBtn = (Button) getView().findViewById(R.id.btn_logout);
    if (!TextUtils.isEmpty(EMClient.getInstance().getCurrentUser())) {
        logoutBtn.setText(
                getString(R.string.button_logout) + "(" + EMClient.getInstance().getCurrentUser() + ")");
    }
    customServerSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_custom_server);

    textview1 = (TextView) getView().findViewById(R.id.textview1);
    textview2 = (TextView) getView().findViewById(R.id.textview2);

    blacklistContainer = (LinearLayout) getView().findViewById(R.id.ll_black_list);
    userProfileContainer = (LinearLayout) getView().findViewById(R.id.ll_user_profile);
    llDiagnose = (LinearLayout) getView().findViewById(R.id.ll_diagnose);
    pushNick = (LinearLayout) getView().findViewById(R.id.ll_set_push_nick);

    settingsModel = SuperWeChatHelper.getInstance().getModel();
    chatOptions = EMClient.getInstance().getOptions();

    blacklistContainer.setOnClickListener(this);
    userProfileContainer.setOnClickListener(this);
    rl_switch_notification.setOnClickListener(this);
    rl_switch_sound.setOnClickListener(this);
    rl_switch_vibrate.setOnClickListener(this);
    rl_switch_speaker.setOnClickListener(this);
    customServerSwitch.setOnClickListener(this);
    rl_custom_server.setOnClickListener(this);
    logoutBtn.setOnClickListener(this);
    llDiagnose.setOnClickListener(this);
    pushNick.setOnClickListener(this);
    rl_switch_chatroom_leave.setOnClickListener(this);
    rl_switch_delete_msg_when_exit_group.setOnClickListener(this);
    rl_switch_auto_accept_group_invitation.setOnClickListener(this);
    rl_switch_adaptive_video_encode.setOnClickListener(this);
    llChange.setOnClickListener(this);

    // the vibrate and sound notification are allowed or not?
    if (settingsModel.getSettingMsgNotification()) {
        notifiSwitch.openSwitch();
    } else {
        notifiSwitch.closeSwitch();
    }

    // sound notification is switched on or not?
    if (settingsModel.getSettingMsgSound()) {
        soundSwitch.openSwitch();
    } else {
        soundSwitch.closeSwitch();
    }

    // vibrate notification is switched on or not?
    if (settingsModel.getSettingMsgVibrate()) {
        vibrateSwitch.openSwitch();
    } else {
        vibrateSwitch.closeSwitch();
    }

    // the speaker is switched on or not?
    if (settingsModel.getSettingMsgSpeaker()) {
        speakerSwitch.openSwitch();
    } else {
        speakerSwitch.closeSwitch();
    }

    // if allow owner leave
    if (settingsModel.isChatroomOwnerLeaveAllowed()) {
        ownerLeaveSwitch.openSwitch();
    } else {
        ownerLeaveSwitch.closeSwitch();
    }

    // delete messages when exit group?
    if (settingsModel.isDeleteMessagesAsExitGroup()) {
        switch_delete_msg_when_exit_group.openSwitch();
    } else {
        switch_delete_msg_when_exit_group.closeSwitch();
    }

    if (settingsModel.isAutoAcceptGroupInvitation()) {
        switch_auto_accept_group_invitation.openSwitch();
    } else {
        switch_auto_accept_group_invitation.closeSwitch();
    }

    if (settingsModel.isAdaptiveVideoEncode()) {
        switch_adaptive_video_encode.openSwitch();
        EMClient.getInstance().callManager().getVideoCallHelper().setAdaptiveVideoFlag(true);
    } else {
        switch_adaptive_video_encode.closeSwitch();
        EMClient.getInstance().callManager().getVideoCallHelper().setAdaptiveVideoFlag(false);
    }

    if (settingsModel.isCustomServerEnable()) {
        customServerSwitch.openSwitch();
    } else {
        customServerSwitch.closeSwitch();
    }
}

From source file:com.google.android.apps.dashclock.ExtensionManager.java

/**
 * Returns a listing of all available (installed) extensions, including those that aren't
 * world-readable./*from  w  w  w.ja  v  a2  s  .  c  o m*/
 */
public List<ExtensionListing> getAvailableExtensions() {
    List<ExtensionListing> availableExtensions = new ArrayList<>();
    PackageManager pm = mApplicationContext.getPackageManager();
    List<ResolveInfo> resolveInfos = pm.queryIntentServices(new Intent(DashClockExtension.ACTION_EXTENSION),
            PackageManager.GET_META_DATA);
    for (ResolveInfo resolveInfo : resolveInfos) {
        ExtensionListing info = new ExtensionListing();
        info.componentName(
                new ComponentName(resolveInfo.serviceInfo.packageName, resolveInfo.serviceInfo.name));
        info.title(resolveInfo.loadLabel(pm).toString());
        Bundle metaData = resolveInfo.serviceInfo.metaData;
        if (metaData != null) {
            info.compatible(ExtensionHost.supportsProtocolVersion(metaData.getInt("protocolVersion")));
            info.worldReadable(metaData.getBoolean("worldReadable", false));
            info.description(metaData.getString("description"));
            String settingsActivity = metaData.getString("settingsActivity");
            if (!TextUtils.isEmpty(settingsActivity)) {
                info.settingsActivity(ComponentName
                        .unflattenFromString(resolveInfo.serviceInfo.packageName + "/" + settingsActivity));
            }
        }

        info.icon(resolveInfo.getIconResource());
        availableExtensions.add(info);
    }

    return availableExtensions;
}