https://static.iklfy.com/static/images/index/16.jpg

安卓来电静音

来电铃声响起后,可通过此代码实现静音而非挂断。

private static int previousMuteMode = -1;

/**
 * 来电静音
 * 
 * @param context
 */
private void toggleRingerMute(Context context)
{
    AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
    if (previousMuteMode == -1)
    {
        previousMuteMode = am.getRingerMode();
        am.setRingerMode(0);
    }
    am.setRingerMode(previousMuteMode);
    previousMuteMode = -1;
}

https://static.iklfy.com/static/images/index/19.jpg

安卓通话免提切换

实现免提开启和关闭,需要添加的权限

/**
 * 免提
 * 
 * @param context
 */
private void toggleSpeaker(Context context)
{
    AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
    am.setMode(AudioManager.MODE_IN_CALL);
    am.setSpeakerphoneOn(!am.isSpeakerphoneOn());
}

https://static.iklfy.com/static/images/index/11.jpg

jQuery原理(原型)

(function(){ 
  var jQuery = window.jQuery = window.$ = function( selector, context ) {
     return new jQuery.fn.init( selector, context);
  };
  jQuery.fn = jQuery.prototype = {
        init:function(selector, context){
           alert(selector);
        },
      add : function() {
          return this;
        }
   }
   jQuery.fn.init.prototype = jQuery.fn; 
})();   

//$("dd").add();