Example usage for android.media RingtoneManager EXTRA_RINGTONE_SHOW_SILENT

List of usage examples for android.media RingtoneManager EXTRA_RINGTONE_SHOW_SILENT

Introduction

In this page you can find the example usage for android.media RingtoneManager EXTRA_RINGTONE_SHOW_SILENT.

Prototype

String EXTRA_RINGTONE_SHOW_SILENT

To view the source code for android.media RingtoneManager EXTRA_RINGTONE_SHOW_SILENT.

Click Source Link

Document

Given to the ringtone picker as a boolean.

Usage

From source file:org.apache.cordova.ringtonepicker.RingtonePicker.java

@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
    this.callbackContext = callbackContext;
    if (action.equals("getRingtone")) {
        Log.d("customPlugin", " getRingtone ");

        Runnable getRingtone = new Runnable() {

            @Override/*w ww  . ja v a 2  s .c o  m*/
            public void run() {
                Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
                intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, "Select ringtone for notifications:");
                intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, false);
                intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
                notification_uri = Settings.System.getString(cordova.getActivity().getContentResolver(),
                        Settings.System.NOTIFICATION_SOUND);
                if (notification_uri == null) {
                    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, (Uri) null);
                } else {
                    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, Uri.parse(notification_uri));
                }
                cordova.setActivityResultCallback(RingtonePicker.this);
                cordova.getActivity().startActivityForResult(intent, 5);
            }
        };
        this.cordova.getActivity().runOnUiThread(getRingtone);
        return true;
    } else {
        return false;
    }
}

From source file:org.apache.cordova.stringtoimagefile.StringToImageFile.java

@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
    this.callbackContext = callbackContext;
    if (action.equals("stringToImage")) {
        Log.d("customPlugin", "stringToImage ");

        Runnable getRingtone = new Runnable() {

            @Override/*from   ww  w  . ja  v a 2 s  .  c  o  m*/
            public void run() {
                Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
                intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, "Select ringtone for notifications:");
                intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, false);
                intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
                notification_uri = Settings.System.getString(cordova.getActivity().getContentResolver(),
                        Settings.System.NOTIFICATION_SOUND);
                if (notification_uri == null) {
                    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, (Uri) null);
                } else {
                    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, Uri.parse(notification_uri));
                }
                cordova.setActivityResultCallback(StringToImageFile.this);
                cordova.getActivity().startActivityForResult(intent, 5);
            }
        };
        this.cordova.getActivity().runOnUiThread(getRingtone);
        return true;
    } else {
        return false;
    }
}

From source file:org.kontalk.ui.prefs.NotificationFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Load the preferences from an XML resource
    addPreferencesFromResource(R.xml.preferences_notification);

    // set ringtone
    final Preference setRingtone = findPreference("pref_ringtone");
    setRingtone.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override/*from  w ww.  ja  v  a 2  s .c  om*/
        public boolean onPreferenceClick(Preference preference) {
            SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(preference.getContext());

            String _currentRingtone = prefs.getString(preference.getKey(),
                    getString(R.string.pref_default_ringtone));
            Uri currentRingtone = !TextUtils.isEmpty(_currentRingtone) ? Uri.parse(_currentRingtone) : null;

            final Intent i = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
            i.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, currentRingtone);
            i.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
            i.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI,
                    RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION));

            i.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
            i.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
            i.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, preference.getTitle());

            startActivityForResult(i, REQUEST_PICK_RINGTONE);
            return true;
        }
    });

    // notification LED color
    final Preference notificationLed = findPreference("pref_notification_led_color");
    notificationLed.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            Context context = getContext();
            int[] ledColors = new int[] { ContextCompat.getColor(context, android.R.color.white),
                    ContextCompat.getColor(context, R.color.blue_light),
                    ContextCompat.getColor(context, R.color.purple_light),
                    ContextCompat.getColor(context, R.color.green_light),
                    ContextCompat.getColor(context, R.color.yellow_light),
                    ContextCompat.getColor(context, R.color.red_light), };

            try {
                new ColorChooserDialog.Builder((BasePreferencesActivity) getActivity(),
                        R.string.pref_notification_led_color).customColors(ledColors, null)
                                .preselect(Preferences.getNotificationLEDColor(getContext()))
                                .allowUserColorInput(false).dynamicButtonColor(false).show();
            } catch (IllegalStateException e) {
                // fragment is being destroyed - ignore
            }
            return true;
        }
    });
}

From source file:org.proninyaroslav.libretorrent.settings.BehaviorSettingsFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final SettingsManager pref = new SettingsManager(getActivity().getApplicationContext());

    String keyTorrentFinishNotify = getString(R.string.pref_key_torrent_finish_notify);
    SwitchPreferenceCompat torrentFinishNotify = (SwitchPreferenceCompat) findPreference(
            keyTorrentFinishNotify);//from  w  ww.  j a v a2 s .c  o  m
    torrentFinishNotify.setChecked(pref.getBoolean(keyTorrentFinishNotify, true));
    bindOnPreferenceChangeListener(torrentFinishNotify);

    String keyPlaySound = getString(R.string.pref_key_play_sound_notify);
    SwitchPreferenceCompat playSound = (SwitchPreferenceCompat) findPreference(keyPlaySound);
    playSound.setChecked(pref.getBoolean(keyPlaySound, true));
    bindOnPreferenceChangeListener(playSound);

    final String keyNotifySound = getString(R.string.pref_key_notify_sound);
    Preference notifySound = findPreference(keyNotifySound);
    String ringtone = pref.getString(keyNotifySound,
            RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION).toString());
    notifySound
            .setSummary(RingtoneManager.getRingtone(getActivity().getApplicationContext(), Uri.parse(ringtone))
                    .getTitle(getActivity().getApplicationContext()));
    /* See https://code.google.com/p/android/issues/detail?id=183255 */
    notifySound.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI,
                    Settings.System.DEFAULT_NOTIFICATION_URI);

            String curRingtone = pref.getString(keyNotifySound, null);
            if (curRingtone != null) {
                if (curRingtone.length() == 0) {
                    // Select "Silent"
                    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, (Uri) null);
                } else {
                    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, Uri.parse(curRingtone));
                }

            } else {
                intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI,
                        Settings.System.DEFAULT_NOTIFICATION_URI);
            }

            startActivityForResult(intent, REQUEST_CODE_ALERT_RINGTONE);

            return true;
        }
    });

    String keyLedIndicator = getString(R.string.pref_key_led_indicator_notify);
    SwitchPreferenceCompat ledIndicator = (SwitchPreferenceCompat) findPreference(keyLedIndicator);
    ledIndicator.setChecked(pref.getBoolean(keyLedIndicator, true));
    bindOnPreferenceChangeListener(ledIndicator);

    String keyLedIndicatorColor = getString(R.string.pref_key_led_indicator_color_notify);
    LightPreference ledIndicatorColor = (LightPreference) findPreference(keyLedIndicatorColor);
    ledIndicatorColor.forceSetValue(pref.getInt(keyLedIndicatorColor,
            ContextCompat.getColor(getActivity().getApplicationContext(), R.color.primary)));
    bindOnPreferenceChangeListener(ledIndicatorColor);

    String keyVibration = getString(R.string.pref_key_vibration_notify);
    SwitchPreferenceCompat vibration = (SwitchPreferenceCompat) findPreference(keyVibration);
    vibration.setChecked(pref.getBoolean(keyVibration, true));
    bindOnPreferenceChangeListener(vibration);

    String keyAutostart = getString(R.string.pref_key_autostart);
    SwitchPreferenceCompat autostart = (SwitchPreferenceCompat) findPreference(keyAutostart);
    autostart.setChecked(pref.getBoolean(keyAutostart, false));
    bindOnPreferenceChangeListener(autostart);

    String keyShutdownComplete = getString(R.string.pref_key_shutdown_downloads_complete);
    SwitchPreferenceCompat shutdownComplete = (SwitchPreferenceCompat) findPreference(keyShutdownComplete);
    shutdownComplete.setChecked(pref.getBoolean(keyShutdownComplete, false));
    bindOnPreferenceChangeListener(shutdownComplete);

    String keyCpuSleep = getString(R.string.pref_key_cpu_do_not_sleep);
    SwitchPreferenceCompat cpuSleep = (SwitchPreferenceCompat) findPreference(keyCpuSleep);
    cpuSleep.setChecked(pref.getBoolean(keyCpuSleep, false));
    bindOnPreferenceChangeListener(cpuSleep);

    String keyOnlyCharging = getString(R.string.pref_key_download_and_upload_only_when_charging);
    SwitchPreferenceCompat onlyCharging = (SwitchPreferenceCompat) findPreference(keyOnlyCharging);
    onlyCharging.setChecked(pref.getBoolean(keyOnlyCharging, false));
    bindOnPreferenceChangeListener(onlyCharging);

    String keyBatteryControl = getString(R.string.pref_key_battery_control);
    SwitchPreferenceCompat batteryControl = (SwitchPreferenceCompat) findPreference(keyBatteryControl);
    batteryControl.setSummary(
            String.format(getString(R.string.pref_battery_control_summary), Utils.getDefaultBatteryLowLevel()));
    batteryControl.setChecked(pref.getBoolean(keyBatteryControl, false));
    bindOnPreferenceChangeListener(batteryControl);
}

From source file:com.microsoft.mimickeralarm.settings.RingtonePreference.java

private void onPrepareRingtonePickerIntent(Intent ringtonePickerIntent) {
    ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, getRingtone());
    ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
    ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI,
            GeneralUtilities.defaultRingtone());
    ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
    ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_ALL);
    ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, getTitle());
}

From source file:org.proninyaroslav.libretorrent.settings.AppearanceSettingsFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final SettingsManager pref = new SettingsManager(getActivity().getApplicationContext());

    String keyTheme = getString(R.string.pref_key_theme);
    ListPreference theme = (ListPreference) findPreference(keyTheme);
    int type = pref.getInt(keyTheme, Integer.parseInt(getString(R.string.pref_theme_light_value)));
    theme.setValueIndex(type);/*from   w  w w  .  j  a  v  a  2s.c  o  m*/
    String typesName[] = getResources().getStringArray(R.array.pref_theme_entries);
    theme.setSummary(typesName[type]);
    bindOnPreferenceChangeListener(theme);

    String keyTorrentFinishNotify = getString(R.string.pref_key_torrent_finish_notify);
    SwitchPreferenceCompat torrentFinishNotify = (SwitchPreferenceCompat) findPreference(
            keyTorrentFinishNotify);
    torrentFinishNotify.setChecked(pref.getBoolean(keyTorrentFinishNotify, true));
    bindOnPreferenceChangeListener(torrentFinishNotify);

    String keyPlaySound = getString(R.string.pref_key_play_sound_notify);
    SwitchPreferenceCompat playSound = (SwitchPreferenceCompat) findPreference(keyPlaySound);
    playSound.setChecked(pref.getBoolean(keyPlaySound, true));
    bindOnPreferenceChangeListener(playSound);

    final String keyNotifySound = getString(R.string.pref_key_notify_sound);
    Preference notifySound = findPreference(keyNotifySound);
    String ringtone = pref.getString(keyNotifySound,
            RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION).toString());
    notifySound
            .setSummary(RingtoneManager.getRingtone(getActivity().getApplicationContext(), Uri.parse(ringtone))
                    .getTitle(getActivity().getApplicationContext()));
    /* See https://code.google.com/p/android/issues/detail?id=183255 */
    notifySound.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI,
                    Settings.System.DEFAULT_NOTIFICATION_URI);

            String curRingtone = pref.getString(keyNotifySound, null);
            if (curRingtone != null) {
                if (curRingtone.length() == 0) {
                    // Select "Silent"
                    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, (Uri) null);
                } else {
                    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, Uri.parse(curRingtone));
                }

            } else {
                intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI,
                        Settings.System.DEFAULT_NOTIFICATION_URI);
            }

            startActivityForResult(intent, REQUEST_CODE_ALERT_RINGTONE);

            return true;
        }
    });

    String keyLedIndicator = getString(R.string.pref_key_led_indicator_notify);
    SwitchPreferenceCompat ledIndicator = (SwitchPreferenceCompat) findPreference(keyLedIndicator);
    ledIndicator.setChecked(pref.getBoolean(keyLedIndicator, true));
    bindOnPreferenceChangeListener(ledIndicator);

    String keyLedIndicatorColor = getString(R.string.pref_key_led_indicator_color_notify);
    ColorPreference ledIndicatorColor = (ColorPreference) findPreference(keyLedIndicatorColor);
    ledIndicatorColor.forceSetValue(pref.getInt(keyLedIndicatorColor,
            ContextCompat.getColor(getActivity().getApplicationContext(), R.color.primary)));
    bindOnPreferenceChangeListener(ledIndicatorColor);

    String keyVibration = getString(R.string.pref_key_vibration_notify);
    SwitchPreferenceCompat vibration = (SwitchPreferenceCompat) findPreference(keyVibration);
    vibration.setChecked(pref.getBoolean(keyVibration, true));
    bindOnPreferenceChangeListener(vibration);
}

From source file:org.isoron.uhabits.helpers.ReminderHelper.java

public static void startRingtonePickerActivity(Fragment fragment, int requestCode) {
    Uri existingRingtoneUri = ReminderHelper.getRingtoneUri(fragment.getContext());
    Uri defaultRingtoneUri = Settings.System.DEFAULT_NOTIFICATION_URI;

    Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI, defaultRingtoneUri);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, existingRingtoneUri);
    fragment.startActivityForResult(intent, requestCode);
}

From source file:com.mattprecious.notisync.profile.SecondaryCustomProfileActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.profile_custom_secondary);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    dbAdapter = new DbAdapter(this);

    if (getIntent().hasExtra("profile")) {
        profile = getIntent().getParcelableExtra("profile");
    } else {//  w  w  w.j a  va 2s. c  om
        profile = new SecondaryProfile();
        profile.setEnabled(true);
        profile.setVibrate(true);
        profile.setLed(true);
    }

    nameField = (EditText) findViewById(R.id.nameField);
    nameField.setText(profile.getName());
    nameField.setOnFocusChangeListener(new OnFocusChangeListener() {

        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (!hasFocus) {
                validateName();

                if (tagField.getText().length() == 0) {
                    tagField.setText(nameField.getText().toString().toLowerCase(Locale.getDefault())
                            .replaceAll("\\s", ""));
                    validateTag();
                }
            }
        }

    });

    tagField = (EditText) findViewById(R.id.tagField);
    tagField.setText(profile.getTag());
    tagField.setOnFocusChangeListener(new OnFocusChangeListener() {

        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (!hasFocus) {
                validateTag();
            }

        }

    });

    tagRequestButton = (ImageButton) findViewById(R.id.tagRequestButton);
    tagRequestButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            SherlockDialogFragment newFragment = new RequestTagsDialogFragment();
            newFragment.show(getSupportFragmentManager(), null);
        }

    });

    unconnectedOnlyCheckBox = (CheckBox) findViewById(R.id.unconnectedOnlyCheckBox);
    unconnectedOnlyCheckBox.setChecked(profile.isUnconnectedOnly());

    ringtoneSelector = (Button) findViewById(R.id.ringtoneSelector);
    ringtoneSelector.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI,
                    RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION));
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, getRingtoneUri(profile.getRingtone()));

            startActivityForResult(intent, REQUEST_CODE_RINGTONE_PICKER);

        }
    });

    vibrateCheckBox = (CheckBox) findViewById(R.id.vibrateCheckBox);
    vibrateCheckBox.setChecked(profile.isVibrate());

    checkForVibrator();

    lightsCheckBox = (CheckBox) findViewById(R.id.lightsCheckBox);
    lightsCheckBox.setChecked(profile.isLed());

    updateRingtoneSelector();
}

From source file:rikka.materialpreference.RingtonePreference.java

/**
 * Prepares the intent to launch the ringtone picker. This can be modified
 * to adjust the parameters of the ringtone picker.
 *
 * @param ringtonePickerIntent The ringtone picker intent that can be
 *            modified by putting extras.
 *//*  w  ww  .j a  va 2 s  .c o  m*/
protected void onPrepareRingtonePickerIntent(Intent ringtonePickerIntent) {

    ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, onRestoreRingtone());

    ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, mShowDefault);
    if (mShowDefault) {
        ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI,
                RingtoneManager.getDefaultUri(getRingtoneType()));
    }

    ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, mShowSilent);
    ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, mRingtoneType);
    ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, getTitle());
}

From source file:org.schabi.terminightor.AlarmItemDetailFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    lastSavedInstaneState = savedInstanceState;
    Activity a = getActivity();/*from   w ww. j a  va  2 s  . c  o m*/
    setAlarmTimeView = (TextView) a.findViewById(R.id.setAlarmTimeView);
    setAlarmAMPMView = (TextView) a.findViewById(R.id.setAlarmAmPmSuffix);
    repeatCheckBox = (CheckBox) a.findViewById(R.id.setRepeatCheckBox);
    chooseDateView = (ChooseDaysView) a.findViewById(R.id.chooseDateView);
    alarmLabelBox = (EditText) a.findViewById(R.id.setAlarmLabelBox);
    setAlarmToneButton = (Button) a.findViewById(R.id.setAlarmToneButton);
    vibrateCheckBox = (CheckBox) a.findViewById(R.id.vibrateCheckBox);
    nfcTagLabelView = (ImageView) a.findViewById(R.id.nfcTagLabelView);
    nfcTagIdView = (TextView) a.findViewById(R.id.nfcTagIdView);
    addNfcTabButton = (FloatingActionButton) a.findViewById(R.id.addNfcTagButton);

    repeatCheckBox.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (repeatCheckBox.isChecked()) {
                chooseDateView.setVisibility(View.VISIBLE);
            } else {
                chooseDateView.setVisibility(View.GONE);
            }
            chooseDateView.setRepeatEnabled(repeatCheckBox.isChecked());
        }
    });

    setAlarmTimeView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            timePickerDialog.show();
        }
    });

    setAlarmToneButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE,
                    getResources().getString(R.string.selectAlarmToneTitle));
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, false);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_ALARM);
            if (!alarm.getAlarmTone().isEmpty()) {
                intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, Uri.parse(alarm.getAlarmTone()));
            }
            startActivityForResult(intent, SET_ALARM_TONE);
        }
    });

    addNfcTabButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(getActivity(), SetTagActivity.class);
            startActivityForResult(intent, READ_NFC_ID);
        }
    });
}