当前位置: 首页>>代码示例>>Java>>正文


Java RingtonePreference类代码示例

本文整理汇总了Java中android.preference.RingtonePreference的典型用法代码示例。如果您正苦于以下问题:Java RingtonePreference类的具体用法?Java RingtonePreference怎么用?Java RingtonePreference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RingtonePreference类属于android.preference包,在下文中一共展示了RingtonePreference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.preference.RingtonePreference; //导入依赖的package包/类
@Override
public void onCreate(Bundle paramBundle) {
  super.onCreate(paramBundle);
  masterSecret = getArguments().getParcelable("master_secret");
  addPreferencesFromResource(R.xml.preferences_notifications);

  this.findPreference(TextSecurePreferences.LED_COLOR_PREF)
      .setOnPreferenceChangeListener(new ListSummaryListener());
  this.findPreference(TextSecurePreferences.LED_BLINK_PREF)
      .setOnPreferenceChangeListener(new ListSummaryListener());
  this.findPreference(TextSecurePreferences.RINGTONE_PREF)
      .setOnPreferenceChangeListener(new RingtoneSummaryListener());
  this.findPreference(TextSecurePreferences.REPEAT_ALERTS_PREF)
      .setOnPreferenceChangeListener(new ListSummaryListener());
  this.findPreference(TextSecurePreferences.NOTIFICATION_PRIVACY_PREF)
      .setOnPreferenceChangeListener(new NotificationPrivacyListener());

  initializeListSummary((ListPreference) findPreference(TextSecurePreferences.LED_COLOR_PREF));
  initializeListSummary((ListPreference) findPreference(TextSecurePreferences.LED_BLINK_PREF));
  initializeListSummary((ListPreference) findPreference(TextSecurePreferences.REPEAT_ALERTS_PREF));
  initializeListSummary((ListPreference) findPreference(TextSecurePreferences.NOTIFICATION_PRIVACY_PREF));
  initializeRingtoneSummary((RingtonePreference) findPreference(TextSecurePreferences.RINGTONE_PREF));
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:24,代码来源:NotificationsPreferenceFragment.java

示例2: onPreferenceChange

import android.preference.RingtonePreference; //导入依赖的package包/类
@Override
public boolean onPreferenceChange(Preference preference, Object value) {
    String stringValue = value.toString();

    if (preference instanceof ListPreference) {
        // For list preferences, look up the correct display value in
        // the preference's 'entries' list.
        ListPreference listPreference = (ListPreference) preference;
        int index = listPreference.findIndexOfValue(stringValue);

        // Set the summary to reflect the new value.
        preference.setSummary(index >= 0 ? listPreference.getEntries()[index] : null);

    } else if (preference instanceof RingtonePreference) {
    } else if (preference instanceof EditTextPreference) {
        EditTextPreference editTextPreference = (EditTextPreference) preference;
        editTextPreference.setSummary(editTextPreference.getText());
    } else {
        // For all other preferences, set the summary to the value's
        // simple string representation.
        preference.setSummary(stringValue);
    }
    return true;
}
 
开发者ID:tranleduy2000,项目名称:text_converter,代码行数:25,代码来源:PreferencesUtil.java

示例3: onCreateView

import android.preference.RingtonePreference; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    DebugLog.logMethod();
    EventBus.getDefault().register(this);

    buildGoogleApiClient();
    findPreference(KEY_EXPORT_TO_DRIVE).setOnPreferenceClickListener(this);
    findPreference(KEY_IMPORT_FROM_DRIVE).setOnPreferenceClickListener(this);

    timePreference = findPreference(KEY_NOTIFICATION_TIME);
    timePreference.setSummary(getNotificationTimeSummary());
    timePreference.setOnPreferenceClickListener(this);

    ringtonePreference = (RingtonePreference) findPreference(KEY_NOTIFICATION_RINGTONE);
    ringtonePreference.setSummary(getRingtoneTitle());

    getPreferenceManager().getSharedPreferences()
            .registerOnSharedPreferenceChangeListener(this);

    showProgressDialog();

    return super.onCreateView(inflater, container, savedInstanceState);
}
 
开发者ID:darsh2,项目名称:CouponsTracker,代码行数:24,代码来源:SettingsFragment.java

示例4: onCreate

import android.preference.RingtonePreference; //导入依赖的package包/类
@Override
public void onCreate(Bundle paramBundle) {
  super.onCreate(paramBundle);
  addPreferencesFromResource(R.xml.preferences_notifications);

  this.findPreference(TextSecurePreferences.LED_COLOR_PREF)
      .setOnPreferenceChangeListener(new ListSummaryListener());
  this.findPreference(TextSecurePreferences.LED_BLINK_PREF)
      .setOnPreferenceChangeListener(new ListSummaryListener());
  this.findPreference(TextSecurePreferences.RINGTONE_PREF)
      .setOnPreferenceChangeListener(new RingtoneSummaryListener());
  this.findPreference(TextSecurePreferences.REPEAT_ALERTS_PREF)
      .setOnPreferenceChangeListener(new ListSummaryListener());

  initializeListSummary((ListPreference) findPreference(TextSecurePreferences.LED_COLOR_PREF));
  initializeListSummary((ListPreference) findPreference(TextSecurePreferences.LED_BLINK_PREF));
  initializeListSummary((ListPreference) findPreference(TextSecurePreferences.REPEAT_ALERTS_PREF));
  initializeRingtoneSummary((RingtonePreference) findPreference(TextSecurePreferences.RINGTONE_PREF));
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:20,代码来源:NotificationsPreferenceFragment.java

示例5: onCreate

import android.preference.RingtonePreference; //导入依赖的package包/类
@Override
public void onCreate(Bundle paramBundle) {
  super.onCreate(paramBundle);
  masterSecret = getArguments().getParcelable("master_secret");
  addPreferencesFromResource(R.xml.preferences_notifications);

  this.findPreference(SilencePreferences.LED_COLOR_PREF)
      .setOnPreferenceChangeListener(new ListSummaryListener());
  this.findPreference(SilencePreferences.LED_BLINK_PREF)
      .setOnPreferenceChangeListener(new ListSummaryListener());
  this.findPreference(SilencePreferences.RINGTONE_PREF)
      .setOnPreferenceChangeListener(new RingtoneSummaryListener());
  this.findPreference(SilencePreferences.REPEAT_ALERTS_PREF)
      .setOnPreferenceChangeListener(new ListSummaryListener());
  this.findPreference(SilencePreferences.NOTIFICATION_PRIVACY_PREF)
      .setOnPreferenceChangeListener(new NotificationPrivacyListener());

  initializeListSummary((ListPreference) findPreference(SilencePreferences.LED_COLOR_PREF));
  initializeListSummary((ListPreference) findPreference(SilencePreferences.LED_BLINK_PREF));
  initializeListSummary((ListPreference) findPreference(SilencePreferences.REPEAT_ALERTS_PREF));
  initializeListSummary((ListPreference) findPreference(SilencePreferences.NOTIFICATION_PRIVACY_PREF));
  initializeRingtoneSummary((RingtonePreference) findPreference(SilencePreferences.RINGTONE_PREF));
}
 
开发者ID:SilenceIM,项目名称:Silence,代码行数:24,代码来源:NotificationsPreferenceFragment.java

示例6: onCreate

import android.preference.RingtonePreference; //导入依赖的package包/类
@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.settings);

    mChatRingtoneKey = getString(R.string.pref_chat_ringtone);
    mChatRingtonePreference = (RingtonePreference) findPreference(mChatRingtoneKey);
   // mLocationCityChangePreference = (ListPreference) findPreference(getActivity().getResources().getString(R.string.pref_location_settings));
    //mLocationCityChangePreference.setEntries();
    mChatRingtonePreference.setOnPreferenceChangeListener(this);
    //mLocationCityChangePreference.setOnPreferenceChangeListener(this);
    updateRingtonePreferenceSummary(mChatRingtonePreference, SharedPreferenceHelper
            .getString(R.string.pref_chat_ringtone));

    //updateLocationPreference(mLocationCityChangePreference,SharedPreferenceHelper.getString(R.string.pref_location_settings));

    mOtherRingtoneKey = getString(R.string.pref_other_ringtone);
    mOtherRingtonePreference = (RingtonePreference) findPreference(mOtherRingtoneKey);
    mOtherRingtonePreference.setOnPreferenceChangeListener(this);
    updateRingtonePreferenceSummary(mOtherRingtonePreference, SharedPreferenceHelper
            .getString(R.string.pref_other_ringtone));


}
 
开发者ID:yeloapp,项目名称:yelo-android,代码行数:25,代码来源:SettingsFragment.java

示例7: updateRingtonePreferenceSummary

import android.preference.RingtonePreference; //导入依赖的package包/类
/**
 * Sets the summary of the Ringtone Preference to the human readable name of the selected
 * ringtone
 *
 * @param ringtonePreference The preference to update
 * @param selectedRingtoneUriString The String version of the selected ringtone Uri
 */
private void updateRingtonePreferenceSummary(final RingtonePreference ringtonePreference, final String selectedRingtoneUriString) {

    if (!TextUtils.isEmpty(selectedRingtoneUriString)) {
        final Ringtone selectedRingtone = RingtoneManager
                .getRingtone(getActivity(), Uri.parse(selectedRingtoneUriString));

        if (selectedRingtone == null) {
            ringtonePreference.setSummary(null);
        } else {
            ringtonePreference.setSummary(selectedRingtone.getTitle(getActivity()));
        }
    } else {
        ringtonePreference.setSummary(null);
    }

}
 
开发者ID:yeloapp,项目名称:yelo-android,代码行数:24,代码来源:SettingsFragment.java

示例8: getRequestCodeViaReflection

import android.preference.RingtonePreference; //导入依赖的package包/类
private int getRequestCodeViaReflection() {
    try {
        // Get request code field by reflection
        Field field = android.preference.RingtonePreference.class.getDeclaredField("mRequestCode");

        // Make it accessible
        field.setAccessible(true);

        // Return it
        return (Integer) field.get(this);
    }
    catch (Exception exc) {
        // Log it
        Log.e(Logging.TAG, "Request code reflection failed", exc);

        // Return error
        return REQUEST_CODE_FAILED;
    }
}
 
开发者ID:eladnava,项目名称:redalert-android,代码行数:20,代码来源:RingtoneSelectionPreference.java

示例9: initializeForPrayerTime

import android.preference.RingtonePreference; //导入依赖的package包/类
private void initializeForPrayerTime(final PrayerTimeType prayerTimeType) {
    String soundKey = Pref.Reminders.SOUND_BASE + prayerTimeType.name;

    RingtonePreference sound = (RingtonePreference) findPreference(soundKey);
    sound.setOnPreferenceChangeListener((preference, newValue) -> {
        updateSoundSummary(preference, (String) newValue);

        return true;
    });

    String currentSound = Pref.Reminders.sound(getActivity(), prayerTimeType);
    updateSoundSummary(sound, currentSound);

    String timeToRemindKey = Pref.Reminders.TIME_TO_REMIND_BASE + prayerTimeType.name;

    ListPreference timeToRemind = (ListPreference) findPreference(timeToRemindKey);
    timeToRemind.setOnPreferenceChangeListener((preference, newValue) -> {
        preference.setSummary(getString(R.string.preferences_reminders_timeToRemindSummary, Integer.parseInt((String) newValue)));

        return true;
    });

    int currentTimeToRemind = Pref.Reminders.timeToRemind(getActivity(), prayerTimeType);
    timeToRemind.setSummary(getString(R.string.preferences_reminders_timeToRemindSummary, currentTimeToRemind));
}
 
开发者ID:mehmetakiftutuncu,项目名称:Muezzin,代码行数:26,代码来源:ReminderPreferencesFragment.java

示例10: onCreate

import android.preference.RingtonePreference; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getActivityComponent().inject(this);
    addPreferencesFromResource(R.xml.preferences);

    reminderListPreference = (ListPreference) findPreference(getString(R.string.pref_key_alarm_reminder));
    bindOnPreferenceChange(reminderListPreference);

    alarmRingtonePreference = (RingtonePreference) findPreference(getString(R.string.pref_key_alarm_ringtone));
    bindOnPreferenceChange(alarmRingtonePreference);

    notificationRingtonePreference = (RingtonePreference) findPreference(getString(R.string.pref_key_notification_ringtone));
    bindOnPreferenceChange(notificationRingtonePreference);

    setCachePreference();
    setSharePreference();
}
 
开发者ID:tjyu1040,项目名称:GallyShuttle,代码行数:19,代码来源:SettingsActivity.java

示例11: onPreferenceChange

import android.preference.RingtonePreference; //导入依赖的package包/类
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
    String value = newValue.toString();
    if (preference instanceof ListPreference) {
        ListPreference listPreference = (ListPreference) preference;
        int index = listPreference.findIndexOfValue(value);
        preference.setSummary(index >= 0 ? listPreference.getEntries()[index] : null);
    } else if (preference instanceof RingtonePreference) {
        if (TextUtils.isEmpty(value)) {
            preference.setSummary(R.string.pref_summary_silent);
        } else {
            Ringtone ringtone = RingtoneManager.getRingtone(preference.getContext(), Uri.parse(value));
            if (ringtone != null) {
                preference.setSummary(ringtone.getTitle(preference.getContext()));
            } else {
                preference.setSummary(null);
            }
        }
    } else {
        preference.setSummary(value);
    }
    return true;
}
 
开发者ID:tjyu1040,项目名称:GallyShuttle,代码行数:24,代码来源:BasePreferenceFragment.java

示例12: assertThatScreenMatchesExpected

import android.preference.RingtonePreference; //导入依赖的package包/类
protected void assertThatScreenMatchesExpected(PreferenceScreen screen) {
  assertThat(screen.getPreferenceCount()).isEqualTo(8);

  assertThat(screen.getPreference(0)).isInstanceOf(PreferenceCategory.class);
  assertThat(((PreferenceCategory) screen.getPreference(0)).getPreference(0)).isInstanceOf(Preference.class);

  PreferenceScreen innerScreen = (PreferenceScreen) screen.getPreference(1);
  assertThat(innerScreen).isInstanceOf(PreferenceScreen.class);
  assertThat(innerScreen.getKey()).isEqualTo("screen");
  assertThat(innerScreen.getTitle().toString()).isEqualTo("Screen Test");
  assertThat(innerScreen.getSummary()).isEqualTo("Screen summary");
  assertThat(innerScreen.getPreference(0)).isInstanceOf(Preference.class);

  assertThat(screen.getPreference(2)).isInstanceOf(CheckBoxPreference.class);
  assertThat(screen.getPreference(3)).isInstanceOf(EditTextPreference.class);
  assertThat(screen.getPreference(4)).isInstanceOf(ListPreference.class);
  assertThat(screen.getPreference(5)).isInstanceOf(Preference.class);
  assertThat(screen.getPreference(6)).isInstanceOf(RingtonePreference.class);
  assertThat(screen.getPreference(7)).isInstanceOf(Preference.class);
}
 
开发者ID:qx,项目名称:FullRobolectricTestSample,代码行数:21,代码来源:PreferenceLoaderTest.java

示例13: onPreferenceChange

import android.preference.RingtonePreference; //导入依赖的package包/类
@Override
public boolean onPreferenceChange(Preference preference, Object value) {
    String stringValue = value.toString();

    if (preference instanceof ListPreference) {


    } else if (preference instanceof RingtonePreference) {

    } else {
        // For all other preferences, set the summary to the value's
        // simple string representation.
        preference.setSummary(stringValue);
    }
    return true;
}
 
开发者ID:znupy,项目名称:ChattyOwl,代码行数:17,代码来源:SettingsActivity.java

示例14: onPreferenceChange

import android.preference.RingtonePreference; //导入依赖的package包/类
@Override
public boolean onPreferenceChange(Preference preference, Object value) {
	String stringValue = value.toString();
	if (preference instanceof ListPreference) {
		ListPreference listPreference = (ListPreference) preference;
		int index = listPreference.findIndexOfValue(stringValue);
		preference	.setSummary(index >= 0 ? listPreference.getEntries()[index]: null);

	} else if (preference instanceof RingtonePreference) {
		if (TextUtils.isEmpty(stringValue)) {
			preference.setSummary(R.string.pref_ringtone_silent);
		} else {
			Ringtone ringtone = RingtoneManager.getRingtone(preference.getContext(), Uri.parse(stringValue));
			if (ringtone == null) {
				preference.setSummary(null);
			} else {
				String name = ringtone
						.getTitle(preference.getContext());
				preference.setSummary(name);
			}
		}
	} else {
		preference.setSummary(stringValue);
	}
	return true;
}
 
开发者ID:ghwoni13,项目名称:BAGO_TS,代码行数:27,代码来源:TS_Settings.java

示例15: onPreferenceChange

import android.preference.RingtonePreference; //导入依赖的package包/类
@Override
public boolean onPreferenceChange(Preference preference, Object value) {
  String stringValue = value.toString();

  if (preference instanceof ListPreference) {
    // For list preferences, look up the correct display value in
    // the preference's 'entries' list.
    ListPreference listPreference = (ListPreference) preference;
    int index = listPreference.findIndexOfValue(stringValue);

    // Set the summary to reflect the new value.
    preference.setSummary(
        index >= 0
            ? listPreference.getEntries()[index]
            : null);

  } else if (preference instanceof RingtonePreference) {
    // For ringtone preferences, look up the correct display value
    // using RingtoneManager.
    if (TextUtils.isEmpty(stringValue)) {
      // Empty values correspond to 'silent' (no ringtone).
      preference.setSummary(R.string.pref_ringtone_silent);

    } else {
      Ringtone ringtone = RingtoneManager.getRingtone(
          preference.getContext(), Uri.parse(stringValue));

      if (ringtone == null) {
        // Clear the summary if there was a lookup error.
        preference.setSummary(null);
      } else {
        // Set the summary to reflect the new ringtone display
        // name.
        String name = ringtone.getTitle(preference.getContext());
        preference.setSummary(name);
      }
    }

  } else {
    // For all other preferences, set the summary to the value's
    // simple string representation.
    preference.setSummary(stringValue);
  }
  return true;
}
 
开发者ID:charlesng,项目名称:SampleAppArch,代码行数:46,代码来源:SettingsActivity.java


注:本文中的android.preference.RingtonePreference类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。