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


Java Compatibility类代码示例

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


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

示例1: getInstance

import com.csipsimple.utils.Compatibility; //导入依赖的package包/类
public static CameraUtilsWrapper getInstance() {
    if (instance == null) {
        if (Compatibility.isCompatible(11)) {
            instance = new CameraUtils11();
        } else if (Compatibility.isCompatible(9)) {
            instance = new CameraUtils9();
        } else if (Compatibility.isCompatible(8)) {
            instance = new CameraUtils8();
        } else if (Compatibility.isCompatible(5)){
            instance = new CameraUtils5();
        }else {
            instance = new CameraUtils3();
        }
    }

    return instance;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:18,代码来源:CameraUtilsWrapper.java

示例2: getInstance

import com.csipsimple.utils.Compatibility; //导入依赖的package包/类
public static BluetoothWrapper getInstance(Context context) {
	if(instance == null) {
	    if(Compatibility.isCompatible(14)) {
	        instance = new BluetoothUtils14();
	    }else if(Compatibility.isCompatible(8)) {
               instance = new BluetoothUtils8();
		}else {
               instance = new BluetoothUtils3();
		}
	    if(instance != null) {
	        instance.setContext(context);
	    }
	}
	
	return instance;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:17,代码来源:BluetoothWrapper.java

示例3: adjustStreamVolume

import com.csipsimple.utils.Compatibility; //导入依赖的package包/类
public void adjustStreamVolume(int streamType, int direction, int flags) {
	broadcastVolumeWillBeUpdated(streamType, EXTRA_VALUE_UNKNOWN);
       audioManager.adjustStreamVolume(streamType, direction, flags);
       if(streamType == AudioManager.STREAM_RING) {
       	// Update ringer 
       	ringer.updateRingerMode();
       }
       
       int inCallStream = Compatibility.getInCallStream(userWantBluetooth);
       if(streamType == inCallStream) {
       	int maxLevel = audioManager.getStreamMaxVolume(inCallStream);
       	float modifiedLevel = (audioManager.getStreamVolume(inCallStream)/(float) maxLevel)*10.0f;
       	// Update default stream level
           service.getPrefs().setPreferenceFloatValue(SipConfigManager.SND_STREAM_LEVEL, modifiedLevel);
       	
       }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:18,代码来源:MediaManager.java

示例4: InCallAnswerControls

import com.csipsimple.utils.Compatibility; //导入依赖的package包/类
public InCallAnswerControls(Context context, AttributeSet attrs, int style) {
    super(context, attrs, style);
    
    lockerWidgetType = LOCKER_GLOWPAD;
    setGravity(Gravity.CENTER_VERTICAL);
    if(!isInEditMode()) {
        int unlockerType = SipConfigManager.getPreferenceIntegerValue(context, SipConfigManager.UNLOCKER_TYPE, 0);
        if(unlockerType <= 0 || unlockerType > 3) {
            AccessibilityWrapper accessibilityManager = AccessibilityWrapper.getInstance();
            accessibilityManager.init(getContext());
            if(accessibilityManager.isEnabled()) {
                lockerWidgetType = LOCKER_BUTTON;
            }
            if (Compatibility.isTabletScreen(getContext())
                    && !Compatibility.isCompatible(Build.VERSION_CODES.ICE_CREAM_SANDWICH)) {
                lockerWidgetType = LOCKER_BUTTON;
            }
        }else {
            lockerWidgetType = unlockerType;
        }
        if(lockerWidgetType == LOCKER_GLOWPAD && !Compatibility.isCompatible(Build.VERSION_CODES.ICE_CREAM_SANDWICH)) {
            lockerWidgetType = LOCKER_SLIDINGTAB;
        }
    }
    
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:27,代码来源:InCallAnswerControls.java

示例5: shouldWarnVpnIcs

import com.csipsimple.utils.Compatibility; //导入依赖的package包/类
public static boolean shouldWarnVpnIcs(PreferencesProviderWrapper prefs) {
    if(prefs.getPreferenceBooleanValue(getIgnoreKey(WARNING_VPN_ICS), false)) {
        return false;
    }
    if(Compatibility.isCompatible(14) && prefs.getPreferenceIntegerValue(SipConfigManager.NETWORK_ROUTES_POLLING) == 0) {
        // services/java/com/android/server/connectivity/Vpn.java
        String[] daemons = new String[] {"racoon", "mtpd"};
        for(String daemon : daemons) {
            String state = prefs.getSystemProp("init.svc." + daemon);
            if("running".equals(state)) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:17,代码来源:WarningUtils.java

示例6: shouldWarnSDCard

import com.csipsimple.utils.Compatibility; //导入依赖的package包/类
public static boolean shouldWarnSDCard(Context ctxt, PreferencesProviderWrapper prefs) {

        if(prefs.getPreferenceBooleanValue(getIgnoreKey(WARNING_SDCARD), false)) {
            return false;
        }
        if(Compatibility.isInstalledOnSdCard(ctxt)) {
            if(prefs.getPreferenceBooleanValue(SipConfigManager.USE_WIFI_IN) || 
                    prefs.getPreferenceBooleanValue(SipConfigManager.USE_3G_IN) || 
                    prefs.getPreferenceBooleanValue(SipConfigManager.USE_GPRS_IN) || 
                    prefs.getPreferenceBooleanValue(SipConfigManager.USE_EDGE_IN) ||
                    prefs.getPreferenceBooleanValue(SipConfigManager.USE_ANYWAY_IN) ) {
                return true;
            }
        }
        return false;
    }
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:17,代码来源:WarningUtils.java

示例7: setAccount

import com.csipsimple.utils.Compatibility; //导入依赖的package包/类
/**
 * Set the currently selected account for this widget
 * It will change internal state,
 * Change icon and label of the account
 * @param aAccount
 */
public void setAccount(SipProfile aAccount) {
    account = aAccount;

    if (account == null) {
        if(isInEditMode() || Compatibility.canMakeGSMCall(getContext())) {
            textView.setText(getResources().getString(R.string.gsm));
            imageView.setImageResource(R.drawable.ic_wizard_gsm);
        }else {
            textView.setText(getResources().getString(R.string.acct_inactive));
            imageView.setImageResource(android.R.drawable.ic_dialog_alert);
        }
    } else {
        textView.setText(account.display_name);
        imageView.setImageDrawable(new BitmapDrawable(getResources(), WizardUtils.getWizardBitmap(getContext(),
                account)));
    }
    if (onAccountChange != null) {
        onAccountChange.onChooseAccount(account);
    }

}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:28,代码来源:AccountChooserButton.java

示例8: getLibFileFromPackage

import com.csipsimple.utils.Compatibility; //导入依赖的package包/类
public static File getLibFileFromPackage(ApplicationInfo appInfo, String libName, boolean allowFallback) {
	Log.v(THIS_FILE, "Dir "+appInfo.dataDir);
	if(Compatibility.isCompatible(9)) {
		try {
			Field f = ApplicationInfo.class.getField("nativeLibraryDir");
			File nativeFile = new File((String) f.get(appInfo), libName);
			if(nativeFile.exists()) {
				Log.v(THIS_FILE, "Found native lib using clean way");
				return nativeFile;
			}
		} catch (Exception e) {
			Log.e(THIS_FILE, "Cant get field for native lib dir", e);
		}
	}
	if(allowFallback) {
		return new File(appInfo.dataDir, "lib" + File.separator + libName);
	}else {
		return null;
	}
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:21,代码来源:NativeLibManager.java

示例9: getContactsByGroup

import com.csipsimple.utils.Compatibility; //导入依赖的package包/类
@Override
public Cursor getContactsByGroup(Context ctxt, String groupName) {

    if (TextUtils.isEmpty(groupName)) {
        return null;
    }

    String[] projection;
    if (Compatibility.isCompatible(11)) {
        projection = new String[] {
                Contacts._ID,
                Contacts.DISPLAY_NAME,
                Contacts.PHOTO_ID,
                Contacts.CONTACT_STATUS_ICON,
                Contacts.CONTACT_STATUS,
                Contacts.CONTACT_PRESENCE,
                Contacts.PHOTO_URI
        };
    } else {
        projection = new String[] {
                Contacts._ID,
                Contacts.DISPLAY_NAME,
                Contacts.PHOTO_ID,
                Contacts.CONTACT_STATUS,
                Contacts.CONTACT_PRESENCE
        };
    }

    Uri searchUri = Uri.withAppendedPath(Contacts.CONTENT_GROUP_URI, Uri.encode(groupName));
    
    
    Cursor c = null;
    try {
        c = ctxt.getContentResolver().query(searchUri, projection, null, null,
                Contacts.DISPLAY_NAME + " ASC");
    } catch(Exception e) {
        Log.e(THIS_FILE, "Error while retrieving group", e);
    }
    return c;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:41,代码来源:ContactsUtils5.java

示例10: getInstance

import com.csipsimple.utils.Compatibility; //导入依赖的package包/类
public static ContactsWrapper getInstance() {
    if (instance == null) {
        if (Compatibility.isCompatible(14)) {
            instance = new ContactsUtils14();
        } else if (Compatibility.isCompatible(5)) {
            instance = new ContactsUtils5();
        } else {
            instance = new ContactsUtils3();
        }
    }

    return instance;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:14,代码来源:ContactsWrapper.java

示例11: getInstance

import com.csipsimple.utils.Compatibility; //导入依赖的package包/类
public static BackupWrapper getInstance(Context context) {
	if(instance == null) {
	    if(Compatibility.isCompatible(8)) {
               instance = new BackupUtils8();
		}else {
               instance = new BackupUtils3();
		}
	    if(instance != null) {
	        instance.setContext(context);
	    }
	}
	
	return instance;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:15,代码来源:BackupWrapper.java

示例12: getInstance

import com.csipsimple.utils.Compatibility; //导入依赖的package包/类
public static AccessibilityWrapper getInstance() {
	if(instance == null) {
		if(Compatibility.isCompatible(4)) {
		    instance = new Accessibility4();
		}else {
		    instance = new Accessibility3();
		}
	}
	
	return instance;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:12,代码来源:AccessibilityWrapper.java

示例13: focus

import com.csipsimple.utils.Compatibility; //导入依赖的package包/类
public void focus(boolean userWantsBT) {
	Log.d(THIS_FILE, "Focus again "+isFocused);
	if(!isFocused) {
		HeadsetButtonReceiver.setService(service.getUAStateReceiver());
		audioManager.registerMediaButtonEventReceiver(headsetButtonReceiverName);
		audioManager.requestAudioFocus(focusChangedListener, 
				Compatibility.getInCallStream(userWantsBT), AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
		isFocused = true;
	}
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:11,代码来源:AudioFocus8.java

示例14: getInstance

import com.csipsimple.utils.Compatibility; //导入依赖的package包/类
public static AudioFocusWrapper getInstance() {
    if (instance == null) {
        if (Compatibility.isCompatible(17)) {
            instance = new AudioFocus17();
        } else if (Compatibility.isCompatible(8)) {
            instance = new AudioFocus8();
        } else {
            instance = new AudioFocus3();
        }
    }

    return instance;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:14,代码来源:AudioFocusWrapper.java

示例15: getKeyguardManager

import com.csipsimple.utils.Compatibility; //导入依赖的package包/类
public static KeyguardWrapper getKeyguardManager(Activity activity) {
    KeyguardWrapper kw;
    if(Compatibility.isCompatible(5)) {
        kw = new Keyguard5();
    } else {
        kw = new Keyguard3();
    }
    kw.initActivity(activity);
    return kw;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:11,代码来源:KeyguardWrapper.java


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