本文整理汇总了Java中eu.bitwalker.useragentutils.DeviceType类的典型用法代码示例。如果您正苦于以下问题:Java DeviceType类的具体用法?Java DeviceType怎么用?Java DeviceType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DeviceType类属于eu.bitwalker.useragentutils包,在下文中一共展示了DeviceType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: supportsWallet
import eu.bitwalker.useragentutils.DeviceType; //导入依赖的package包/类
public boolean supportsWallet(String userAgentHeaderValue) {
if (StringUtils.isBlank(userAgentHeaderValue)) {
return false;
}
UserAgent userAgent = new UserAgent(userAgentHeaderValue);
if (userAgent.getOperatingSystem().getDeviceType() == DeviceType.MOBILE
&& userAgent.getOperatingSystem().getGroup() == OperatingSystem.IOS
&& userAgent.getOperatingSystem().getId() >= OperatingSystem.iOS6_IPHONE.getId()) {
return true;
}
Version oldestSafariVersionWithGuaranteedSupport = new Version("6.2", "6", "2"); // Mac OS X 10.8.2 or later required to install this Safari version
if (userAgent.getOperatingSystem() == OperatingSystem.MAC_OS_X
&& userAgent.getBrowser().getGroup() == Browser.SAFARI
&& userAgent.getBrowserVersion().compareTo(oldestSafariVersionWithGuaranteedSupport) >= 0) {
return true;
}
return false;
}
示例2: isMobileOrUnknownDevice
import eu.bitwalker.useragentutils.DeviceType; //导入依赖的package包/类
private boolean isMobileOrUnknownDevice(String userAgentHeaderValue) {
if (StringUtils.isBlank(userAgentHeaderValue)) {
return false;
}
UserAgent userAgent = new UserAgent(userAgentHeaderValue);
return userAgent.getOperatingSystem().getDeviceType() == DeviceType.MOBILE;
}
示例3: UserAgentResource
import eu.bitwalker.useragentutils.DeviceType; //导入依赖的package包/类
public UserAgentResource(Browser browser, Browser browserGroup, BrowserType browserType, OperatingSystem operatingSystem, OperatingSystem operatingSystemGroup, DeviceType deviceType) {
this.browser = browser;
this.browserGroup = browserGroup;
this.browserType = browserType;
this.operatingSystem = operatingSystem;
this.operatingSystemGroup = operatingSystemGroup;
this.deviceType = deviceType;
}
示例4: getDeviceType
import eu.bitwalker.useragentutils.DeviceType; //导入依赖的package包/类
public DeviceType getDeviceType() {
return this.deviceType;
}
示例5: isMobileRequest
import eu.bitwalker.useragentutils.DeviceType; //导入依赖的package包/类
public static boolean isMobileRequest(){
return DeviceType.MOBILE.equals(getRequestDeviceType());
}
示例6: getRequestDeviceType
import eu.bitwalker.useragentutils.DeviceType; //导入依赖的package包/类
public static DeviceType getRequestDeviceType(){
UserAgent userAgent = getUserAgent();
return userAgent.getOperatingSystem().getDeviceType();
}
示例7: getStbView
import eu.bitwalker.useragentutils.DeviceType; //导入依赖的package包/类
public ModelAndView getStbView(HttpServletRequest req, HttpServletResponse resp, String deviceId,
String mobile, String remoteType, String refresh, String uaStr, String stbViewType) {
accessValidator.validateUserHasAccessToDevices(req, resp, true, deviceId);
MetaStb stb = null;
boolean ref = refresh == null ? false : Boolean.parseBoolean(refresh);
try {
stb = metaStbCache.getMetaStb(deviceId, ref);
} catch (HttpRuntimeException e) {
LOGGER.error("Failed to fetch the STB detail.", e);
}
ModelAndView mav;
if (stb == null) {
mav = new ModelAndView(NOSTB);
mav.addObject(DEVICE_ID, deviceId);
} else {
boolean supported = BrowserSupport.isBrowserSupported(uaStr);
String videoUrl = getVideoUrl(stb);
String audioUrlOgg = getAudioUrl(stb, AudioType.OGG);
String audioUrlMpeg = getAudioUrl(stb, AudioType.MPEG);
Boolean mob = false;
if (mobile == null) {
DeviceType deviceType = UserAgent.parseUserAgentString(uaStr).getOperatingSystem().getDeviceType();
mob = deviceType.equals(DeviceType.MOBILE) || deviceType.equals(DeviceType.TABLET);
} else {
mob = Boolean.parseBoolean(mobile);
}
if(remoteType == null) {
remoteType = stb.getRemoteType();
}
Remote remote = getRemote(remoteType);
Set <String> remoteTypes = remoteManager.getRemoteTypes();
mav = new ModelAndView(stbViewType);
mav.addObject(DEVICE_ID, DawgUtil.toLowerAlphaNumeric(deviceId));
try {
mav.addObject(REMOTE_TYPES, jsonEngine.writeToString(remoteTypes, Set.class));
} catch (CerealException exception) {
LOGGER.error("Cereal exception while loading remote types", exception);
}
mav.addObject(STB_PARAM, stb);
mav.addObject(REMOTE_MANAGER, remoteManager);
mav.addObject(REMOTE, remote);
mav.addObject(SELECTED_REMOTE_TYPE, remoteType);
mav.addObject(MOBILE, mob);
mav.addObject(VIDEO_URL, videoUrl);
mav.addObject(VIDEO_AVAILABLE, validUrl(videoUrl) || validUrl(stb.getHdVideoUrl()));
mav.addObject(HD_VIDEO_URL, stb.getHdVideoUrl());
mav.addObject(TRACE_AVAILABLE, validUrl(stb.getSerialHost()));
mav.addObject(TRACE_HOST, stb.getSerialHost());
mav.addObject(IR_AVAILABLE, validUrl(stb.getIrServiceUrl()) && validUrl(stb.getIrServicePort()));
mav.addObject(SUPPORTED, supported);
mav.addObject(IPADDRESS, stb.getIpAddress().getHostName());
mav.addObject(AUDIO_URL_MPEG, audioUrlMpeg);
mav.addObject(AUDIO_URL_OGG, audioUrlOgg);
}
return mav;
}
示例8: getDeviceType
import eu.bitwalker.useragentutils.DeviceType; //导入依赖的package包/类
@Nonnull
public DeviceType getDeviceType() {
return Objects.firstNonNull(getOperatingSystem().getDeviceType(), DeviceType.UNKNOWN);
}
示例9: isTablet
import eu.bitwalker.useragentutils.DeviceType; //导入依赖的package包/类
/**
* Determines whether user agent is a tablet
* @return true if tablet
*/
public boolean isTablet() {
return DeviceType.TABLET.equals(getDeviceType()) ||
userAgentString.contains(NEXUS_7_SIGNATURE) ||
userAgentString.contains(KINDLE_FIRE_SIGNATURE);
}
示例10: getDeviceType
import eu.bitwalker.useragentutils.DeviceType; //导入依赖的package包/类
/**
* 获取设备类型
*
* @param request
* @return
*/
public static DeviceType getDeviceType(HttpServletRequest request) {
return getUserAgent(request).getOperatingSystem().getDeviceType();
}
示例11: isComputer
import eu.bitwalker.useragentutils.DeviceType; //导入依赖的package包/类
/**
* 是否是PC
*
* @param request
* @return
*/
public static boolean isComputer(HttpServletRequest request) {
return DeviceType.COMPUTER.equals(getDeviceType(request));
}
示例12: isMobile
import eu.bitwalker.useragentutils.DeviceType; //导入依赖的package包/类
/**
* 是否是手机
*
* @param request
* @return
*/
public static boolean isMobile(HttpServletRequest request) {
return DeviceType.MOBILE.equals(getDeviceType(request));
}
示例13: isTablet
import eu.bitwalker.useragentutils.DeviceType; //导入依赖的package包/类
/**
* 是否是平板
*
* @param request
* @return
*/
public static boolean isTablet(HttpServletRequest request) {
return DeviceType.TABLET.equals(getDeviceType(request));
}
示例14: isMobileOrTablet
import eu.bitwalker.useragentutils.DeviceType; //导入依赖的package包/类
/**
* 是否是手机和平板
*
* @param request
* @return
*/
public static boolean isMobileOrTablet(HttpServletRequest request) {
DeviceType deviceType = getDeviceType(request);
return DeviceType.MOBILE.equals(deviceType) || DeviceType.TABLET.equals(deviceType);
}
示例15: getDeviceType
import eu.bitwalker.useragentutils.DeviceType; //导入依赖的package包/类
/**
* 获取设备类型
* @param request
* @return
*/
public static DeviceType getDeviceType(HttpServletRequest request){
return getUserAgent(request).getOperatingSystem().getDeviceType();
}