当前位置:  编程技术>移动开发
本页文章导读:
    ▪穿梭NTLM HTTPProxy        穿越NTLM HTTPProxy 1、Http连接有两种方法穿越NTLM的HTTP Proxy。1.1、第一种使用HttpURLConnection,详细参见:http://www.ibm.com/developerworks/cn/java/j-lo-jse62/index.html1.2、第二种是使用org.apache.commons.httpclien.........
    ▪ 在Titanium中兑现图片的Rotate和Pinch Gesture        在Titanium中实现图片的Rotate和Pinch Gesture 在iPhone中,图片的缩放,移动,旋转以及Pinch Gesture功能在Titanium Mobile中并不支持这样Gesture。这里有人做了一个Module来实现这个功能。(只限于iOS)G.........
    ▪ 在Titanium中处置手机的方向       在Titanium中处理手机的方向 【原文】Handling Device OrientationRun-time Device Orientation DetectionYou can detect the current device orientation by checking value of the Ti.UI.orientation property. This value will match one of the ori.........

[1]穿梭NTLM HTTPProxy
    来源: 互联网  发布时间: 2014-02-18
穿越NTLM HTTPProxy
1、Http连接有两种方法穿越NTLM的HTTP Proxy。

1.1、第一种使用HttpURLConnection,详细参见:

http://www.ibm.com/developerworks/cn/java/j-lo-jse62/index.html

1.2、第二种是使用org.apache.commons.httpclient.HttpClient,该类介绍详见:

http://blog.csdn.net/joy_jiang/archive/2005/03/17/321858.aspx
2、axis 1.4的包中使用的HTTP通信的类是org.apache.axis.transport.http.HTTPSender,该类使用了Socket直接通信

3、为了实现穿越NTLM的HTTP代理,修改org.apache.axis.client包下的client-config.wsdd文件,axis提供了1.2的方式解决ntlm认证的问题。

<transport name="http" pivot="java:org.apache.axis.transport.http.CommonsHTTPSender"> < transport name="http" pivot="java:org.apache.axis.transport.http.CommonsHTTPSender"/ >

4、axis 1.4的CommonsHTTPSender有问题(也许只是某些下载版本),直接运行会报host is null类似的错,细观之,发现getHostConfiguration函数中在走proxy的时候未调用config.setHost(....)所致,修改后重新打包

5、需要穿越proxy的时候,添加下面代码即可。
</transport>
        Properties systemSettings = System.getProperties();<o:p></o:p>
        systemSettings.put("http.proxyHost","xxx.com") ;<o:p></o:p>
        systemSettings.put("http.proxyPort", "8080") ;<o:p></o:p>
        systemSettings.put("http.proxyUser", "domain\\name") ;<o:p></o:p>
        systemSettings.put("http.proxyPassword", "123456") ;<o:p></o:p>
http://docs.oracle.com/javase/6/docs/technotes/guides/net/http-auth.html

    
[2] 在Titanium中兑现图片的Rotate和Pinch Gesture
    来源: 互联网  发布时间: 2014-02-18
在Titanium中实现图片的Rotate和Pinch Gesture
在iPhone中,图片的缩放,移动,旋转以及Pinch Gesture功能在Titanium Mobile中并不支持这样Gesture。这里有人做了一个Module来实现这个功能。(只限于iOS)

Gesture-Recognizer

在view中将rotateGesture、pinchGesture设置为true后,就能处理rotate,pinch的事件了。

Gesture完成后,将触发rotateend、pinchend事件。

代码大概是下边这样:
var window = Ti.UI.createWindow({  
    orientationModes:[  
              Ti.UI.LANDSCAPE_LEFT,  
              Ti.UI.LANDSCAPE_RIGHT,  
              Ti.UI.PORTRAIT,  
              Ti.UI.UPSIDE_PORTRAIT  
             ]  
});  
  
var image = Ti.UI.createImageView({  
    image:"lena_std.jpg",  
    rotateGesture:true,  
    pinchGesture:true  
});  
var lastAngle = 0.0;  
var currentAngle = 0.0;  
  
var lastScale = 1.0;  
var currentScale = 1.0;  
  
image.addEventListener('rotate', function(e){  
    currentAngle = e.rotation / Math.PI * 180.0;  
    image.transform = Ti.UI.create2DMatrix()  
        .scale(lastScale*currentScale)  
        .rotate(lastAngle+currentAngle);  
});  
  
image.addEventListener('rotateend', function(e){  
    lastAngle = (lastAngle + currentAngle) % 360.0;  
    currentAngle = 0.0;  
});  
  
image.addEventListener('pinch', function(e){  
    currentScale = e.scale;  
    image.transform = Ti.UI.create2DMatrix()  
        .scale(lastScale*currentScale)  
        .rotate(lastAngle+currentAngle);  
});  
  
image.addEventListener('pinchend', function(e){  
    lastScale = (lastScale * currentScale);  
    currentScale = 1.0;  
});  
  
window.add(image);  
window.open(); 


效果图如下:



    
[3] 在Titanium中处置手机的方向
    来源: 互联网  发布时间: 2014-02-18
在Titanium中处理手机的方向
【原文】Handling Device Orientation

Run-time Device Orientation Detection
You can detect the current device orientation by checking value of the Ti.UI.orientation property. This value will match one of the orientation constants defined under the Ti.UI namespace:

  • Ti.UI.PORTRAIT
  • Ti.UI.UPSIDE_PORTRAIT
  • Ti.UI.LANDSCAPE_LEFT
  • Ti.UI.LANDSCAPE_RIGHT

An example use of this property might be to define helper functions to determine if the device is in a landscape or portrait orientation:

Ti.Gesture.isLandscape = function (orient) {
  orient = orient || Ti.UI.orientation;
  return orient == Ti.UI.LANDSCAPE_LEFT || orient == Ti.UI.LANDSCAPE_RIGHT;
};
 
Ti.Gesture.isPortrait = function (orient) {
  orient = orient || Ti.UI.orientation;
  return orient == Ti.UI.PORTRAIT || orient == Ti.UI.UPSIDE_PORTRAIT;
};


Handling Orientation Changes
Orientation changes can be detected by attaching an event listener for orientationchange event in the Ti.Gesture module:

Ti.Gesture.addEventListener('orientationchange', function (e) {
  // Put your handling code here
});

The updated device orientation can be read from orientation property of the event object passed to the callback, which will be defined as one of:

  • Ti.UI.PORTRAIT
  • Ti.UI.UPSIDE_PORTRAIT
  • Ti.UI.LANDSCAPE_LEFT
  • Ti.UI.LANDSCAPE_RIGHT

Using our helper function above, you might use the following code to redraw your application UI based on device orientation:

Ti.Gesture.addEventListener('orientationchange', function (ev) {
  if (Ti.Gesture.isLandscape(ev.orientation)) {
    // Update your UI for landscape orientation
  } else {
    // Update your UI for portrait orientation
  }
});


Changing Device Orientation Programmatically
There are two ways of changing the device orientation in JavaScript. One can modify Ti.UI global value or limit the number of supported orientations for a given window object.

Changing the global orientation
First, you can change it directly by updating the value of Ti.UI.orientation property with the appropriate orientation constant:

Ti.UI.orientation = Ti.UI.PORTRAIT;

This approach is recommended if you need to permanently change device orientation and stick to it. You can accomplish the same thing using the orientation section of the tiapp.xml file (for iOS).

Limiting supported orientation modes for a given window
You can limit allowed orientations for a Window object. Then device will go into the desired orientation whenever the window is opened:

var win = Ti.UI.createWindow({
    width: '100%',
    height: '100%',
    orientationModes: [
        Titanium.UI.LANDSCAPE_LEFT,
        Titanium.UI.LANDSCAPE_RIGHT
    ]
});

This specific window will support only landscape mode, so whenever you call win.open() or Ti.UI.currentTab.open(win) the device will go landscape. Whenever you close close the window (or user navigate back using navigation controller) the screen will return back to the actual physical orientation of the device.

You can also update orientationModes of existing windows (including the opened one):

Ti.UI.currentWindow.orientationModes = [
    Titanium.UI.LANDSCAPE_LEFT,
    Titanium.UI.LANDSCAPE_RIGHT
];



    
最新技术文章:
▪Android开发之登录验证实例教程
▪Android开发之注册登录方法示例
▪Android获取手机SIM卡运营商信息的方法
▪Android实现将已发送的短信写入短信数据库的...
▪Android发送短信功能代码
▪Android根据电话号码获得联系人头像实例代码
▪Android中GPS定位的用法实例
▪Android实现退出时关闭所有Activity的方法
▪Android实现文件的分割和组装
▪Android录音应用实例教程
▪Android双击返回键退出程序的实现方法
▪Android实现侦听电池状态显示、电量及充电动...
▪Android获取当前已连接的wifi信号强度的方法
▪Android实现动态显示或隐藏密码输入框的内容
▪根据USER-AGENT判断手机类型并跳转到相应的app...
▪Android Touch事件分发过程详解
▪Android中实现为TextView添加多个可点击的文本
▪Android程序设计之AIDL实例详解
▪Android显式启动与隐式启动Activity的区别介绍
▪Android按钮单击事件的四种常用写法总结
▪Android消息处理机制Looper和Handler详解
▪Android实现Back功能代码片段总结
▪Android实用的代码片段 常用代码总结
▪Android实现弹出键盘的方法
▪Android中通过view方式获取当前Activity的屏幕截...
▪Android提高之自定义Menu(TabMenu)实现方法
▪Android提高之多方向抽屉实现方法
▪Android提高之MediaPlayer播放网络音频的实现方法...
▪Android提高之MediaPlayer播放网络视频的实现方法...
▪Android提高之手游转电视游戏的模拟操控
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3