本文整理匯總了Java中android.app.NotificationChannel.getSound方法的典型用法代碼示例。如果您正苦於以下問題:Java NotificationChannel.getSound方法的具體用法?Java NotificationChannel.getSound怎麽用?Java NotificationChannel.getSound使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.app.NotificationChannel
的用法示例。
在下文中一共展示了NotificationChannel.getSound方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: myhashcode
import android.app.NotificationChannel; //導入方法依賴的package包/類
@TargetApi(26)
private static int myhashcode(NotificationChannel x) {
int result = x.getId() != null ? x.getId().hashCode() : 0;
//result = 31 * result + (getName() != null ? getName().hashCode() : 0);
//result = 31 * result + (getDescription() != null ? getDescription().hashCode() : 0);
//result = 31 * result + getImportance();
//result = 31 * result + (mBypassDnd ? 1 : 0);
//result = 31 * result + getLockscreenVisibility();
result = 31 * result + (x.getSound() != null ? x.getSound().hashCode() : 0);
//result = 31 * result + (x.mLights ? 1 : 0);
result = 31 * result + x.getLightColor();
result = 31 * result + Arrays.hashCode(x.getVibrationPattern());
//result = 31 * result + getUserLockedFields();
//result = 31 * result + (mVibrationEnabled ? 1 : 0);
//result = 31 * result + (mShowBadge ? 1 : 0);
//result = 31 * result + (isDeleted() ? 1 : 0);
//result = 31 * result + (getGroup() != null ? getGroup().hashCode() : 0);
//result = 31 * result + (getAudioAttributes() != null ? getAudioAttributes().hashCode() : 0);
//result = 31 * result + (isBlockableSystem() ? 1 : 0);
return result;
}
示例2: isSoundDifferent
import android.app.NotificationChannel; //導入方法依賴的package包/類
@TargetApi(26)
public static boolean isSoundDifferent(String id, NotificationChannel x) {
if (x.getSound() == null) return false; // this does not have a sound
final NotificationChannel c = getNotifManager().getNotificationChannel(id);
if (c == null) return false; // no channel with this id
if (c.getSound() == null)
return false; // this maybe will only happen if user disables sound so lets not create a new one in that case
final String original_sound = PersistentStore.getString("original-channel-sound-" + id);
if (original_sound.equals("")) {
PersistentStore.setString("original-channel-sound-" + id, x.getSound().toString());
return false; // no existing record so save the original and do nothing else
}
if (original_sound.equals(x.getSound().toString()))
return false; // its the same sound still
return true; // the sound has changed vs the original
}