- Connect device via USB and make sure debugging is working.
adb tcpip 5555adb connect <DEVICE_IP_ADDRESS>:5555- Disconnect USB and proceed with wireless debugging.
adb -s <DEVICE_IP_ADDRESS>:5555 usbto switch back when done.
2015年11月20日星期五
Debug with wifi for android dev
2015年11月17日星期二
IT Books 3.0 released
New version includes Google Login, Google Drive to save books, Material Design on detail-view.
The new Google Login by new Google SigIn API which provides easy way to connect on Google. A lot confused codes are removed when login and new thinking of App-Flow is created:
1. App start without account.
2. Some features depending on account will be first hidden or unavailable.
3. App connects to account.
4. Features will be opened.
Google Drive is a very nice place to save data background permanently. With integration of Drive SDK Android we can implement backup very easily. The SDK controls whole upload and download process as user doesn't take any care on network transactions. The only ones to do is success-handling and error-handling to info UI.
To the detail-view the CoordinatorLayout is used to replace my own implement. The standard behavior with FAB and progress-toast cooperate downloading process dynamically. Checkout a simple sample of CoordinatorLayout here https://github.com/chrisbanes/cheesesquare
IT Books 3.0
The new Google Login by new Google SigIn API which provides easy way to connect on Google. A lot confused codes are removed when login and new thinking of App-Flow is created:
1. App start without account.
2. Some features depending on account will be first hidden or unavailable.
3. App connects to account.
4. Features will be opened.
Google Drive is a very nice place to save data background permanently. With integration of Drive SDK Android we can implement backup very easily. The SDK controls whole upload and download process as user doesn't take any care on network transactions. The only ones to do is success-handling and error-handling to info UI.
To the detail-view the CoordinatorLayout is used to replace my own implement. The standard behavior with FAB and progress-toast cooperate downloading process dynamically. Checkout a simple sample of CoordinatorLayout here https://github.com/chrisbanes/cheesesquare
IT Books 3.0
P.S App has a new icon now :)
2015年11月3日星期二
"Developer Daily" runs internationally.
The Android-App "Developer Daily" which is known as "IT Daily News" or "Developer Daily News" has been updated with international data-source.
The first group of international data is from Android Developer Blog, Google Developer Blog, Android Official Blog, Google Official Blog, Golang Blog, Google Cloud Platform Blog. Including former Chinese source, the application is now available for west users.
The idea of "Developer Daily" is not a beautiful app with to many animation etc, the target of this gadget is only to catch latest what happening in the developer world like Android, Google , might be Apple .
Almost every developer sits on the his desk to code and code without time to read what's going on in his tech-world. Obversely by using this small tool-kit developer can get latest information just on the way to work. To obtain latest info is more important than standby.
More an more news source will be added into.
Download:
P.S I updated API to fetch some latest tech-news from China or lots from who hosted by www.blogger.com.
SDK has also been updated.
The first group of international data is from Android Developer Blog, Google Developer Blog, Android Official Blog, Google Official Blog, Golang Blog, Google Cloud Platform Blog. Including former Chinese source, the application is now available for west users.
The idea of "Developer Daily" is not a beautiful app with to many animation etc, the target of this gadget is only to catch latest what happening in the developer world like Android, Google , might be Apple .
Almost every developer sits on the his desk to code and code without time to read what's going on in his tech-world. Obversely by using this small tool-kit developer can get latest information just on the way to work. To obtain latest info is more important than standby.
More an more news source will be added into.
Download:
SDK has also been updated.
2015年10月27日星期二
Facebook sharing in WhatsUp News, new update for "Developer Daily News"
I've just added standalone sharing on Facebook for WhatsUp in order to avoid bug of pre-install sharing. In new version of application user can now share news directly from notification center including on Facebook.
Here download new version:
Here download new version:
A second update is former "IT Daily News" with changing it application-name to "Developer Daily News", in Chinese “开发者快讯”. New feature is Facebook-sharing in detail view and some bug fixings.
Here download new version:
2015年10月12日星期一
Android之手势的识别与处理(双击onDoubleTap、滑动onFling、拖动onScroll)
概述:
一般情况下,我们知道View类有个View.OnTouchListener内部接口,通过重写他的onTouch(View v, MotionEvent event)方法,我们可以处理一些touch事件,但是这个方法太过简单,如果需要处理一些复杂的手势,用这个接口就会很麻烦(因为我们要自己根据用户触摸的轨迹去判断是什么手势)。
Android sdk给我们提供了GestureDetector(Gesture:手势Detector:识别)类,通过这个类我们可以识别很多的手势,主要是通过他的onTouchEvent(event)方法完成了不同手势的识别。虽然他能识别手势,但是不同的手势要怎么处理,应该是提供给程序员实现的。
GestureDetector这个类对外提供了两个接口:OnGestureListener,OnDoubleTapListener,还有一个内部类SimpleOnGestureListener。
GestureDetector.OnDoubleTapListener接口:用来通知DoubleTap事件,类似于鼠标的双击事件。
1,onDoubleTap(MotionEvent e):在双击的第二下,Touch down时触发 。
2,onDoubleTapEvent(MotionEvent e):通知DoubleTap手势中的事件,包含down、up和move事件(这里指的是在双击之间发生的事件,例如在同一个地方双击会产生DoubleTap手势,而在DoubleTap手势里面还会发生down和up事件,这两个事件由该函数通知);双击的第二下Touch down和up都会触发,可用e.getAction()区分。
3,onSingleTapConfirmed(MotionEvent e):用来判定该次点击是SingleTap而不是DoubleTap,如果连续点击两次就是DoubleTap手势,如果只点击一次,系统等待一段时间后没有收到第二次点击则判定该次点击为SingleTap而不是DoubleTap,然后触发SingleTapConfirmed事件。这个方法不同于onSingleTapUp,他是在GestureDetector确信用户在第一次触摸屏幕后,没有紧跟着第二次触摸屏幕,也就是不是“双击”的时候触发
GestureDetector.OnGestureListener接口:用来通知普通的手势事件,该接口有如下六个回调函数:
1. onDown(MotionEvent e):down事件;
2. onSingleTapUp(MotionEvent e):一次点击up事件;在touch down后又没有滑动
(onScroll),又没有长按(onLongPress),然后Touchup时触发。
点击一下非常快的(不滑动)Touchup:
onDown->onSingleTapUp->onSingleTapConfirmed
点击一下稍微慢点的(不滑动)Touchup:
onDown->onShowPress->onSingleTapUp->onSingleTapConfirmed
3. onShowPress(MotionEvent e):down事件发生而move或则up还没发生前触发该
事件;Touch了还没有滑动时触发(与onDown,onLongPress)比较onDown只要Touch down一定立刻触发。而Touchdown后过一会没有滑动先触发onShowPress再是onLongPress。所以Touchdown后一直不滑动
按照onDown->onShowPress->onLongPress这个顺序触发。
4. onLongPress(MotionEvent e):长按事件;Touch了不移动一直Touch down时触发;
5. onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY):滑动手
势事件;Touch了滑动一点距离后,在ACTION_UP时才会触发 ;
参数:e1 第1个ACTION_DOWN MotionEvent 并且只有一个;e2 最后一个ACTION_MOVE MotionEvent ;velocityX X轴上的移动速度,像素/秒 ;velocityY Y轴上的移动速度,像素/秒.触发条件:X轴的坐标位移大于FLING_MIN_DISTANCE,且移动速度大于FLING_MIN_VELOCITY个像素/秒
6. onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY):在屏幕上
拖动事件。无论是用手拖动view,或者是以抛的动作滚动,都会多次触发,这个方法在ACTION_MOVE动作发生时就会触发。
Android sdk给我们提供了GestureDetector(Gesture:手势Detector:识别)类,通过这个类我们可以识别很多的手势,主要是通过他的onTouchEvent(event)方法完成了不同手势的识别。虽然他能识别手势,但是不同的手势要怎么处理,应该是提供给程序员实现的。
GestureDetector这个类对外提供了两个接口:OnGestureListener,OnDoubleTapListener,还有一个内部类SimpleOnGestureListener。
GestureDetector.OnDoubleTapListener接口:用来通知DoubleTap事件,类似于鼠标的双击事件。
1,onDoubleTap(MotionEvent e):在双击的第二下,Touch down时触发 。
2,onDoubleTapEvent(MotionEvent e):通知DoubleTap手势中的事件,包含down、up和move事件(这里指的是在双击之间发生的事件,例如在同一个地方双击会产生DoubleTap手势,而在DoubleTap手势里面还会发生down和up事件,这两个事件由该函数通知);双击的第二下Touch down和up都会触发,可用e.getAction()区分。
3,onSingleTapConfirmed(MotionEvent e):用来判定该次点击是SingleTap而不是DoubleTap,如果连续点击两次就是DoubleTap手势,如果只点击一次,系统等待一段时间后没有收到第二次点击则判定该次点击为SingleTap而不是DoubleTap,然后触发SingleTapConfirmed事件。这个方法不同于onSingleTapUp,他是在GestureDetector确信用户在第一次触摸屏幕后,没有紧跟着第二次触摸屏幕,也就是不是“双击”的时候触发
GestureDetector.OnGestureListener接口:用来通知普通的手势事件,该接口有如下六个回调函数:
1. onDown(MotionEvent e):down事件;
2. onSingleTapUp(MotionEvent e):一次点击up事件;在touch down后又没有滑动
(onScroll),又没有长按(onLongPress),然后Touchup时触发。
点击一下非常快的(不滑动)Touchup:
onDown->onSingleTapUp->onSingleTapConfirmed
点击一下稍微慢点的(不滑动)Touchup:
onDown->onShowPress->onSingleTapUp->onSingleTapConfirmed
3. onShowPress(MotionEvent e):down事件发生而move或则up还没发生前触发该
事件;Touch了还没有滑动时触发(与onDown,onLongPress)比较onDown只要Touch down一定立刻触发。而Touchdown后过一会没有滑动先触发onShowPress再是onLongPress。所以Touchdown后一直不滑动
按照onDown->onShowPress->onLongPress这个顺序触发。
4. onLongPress(MotionEvent e):长按事件;Touch了不移动一直Touch down时触发;
5. onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY):滑动手
势事件;Touch了滑动一点距离后,在ACTION_UP时才会触发 ;
参数:e1 第1个ACTION_DOWN MotionEvent 并且只有一个;e2 最后一个ACTION_MOVE MotionEvent ;velocityX X轴上的移动速度,像素/秒 ;velocityY Y轴上的移动速度,像素/秒.触发条件:X轴的坐标位移大于FLING_MIN_DISTANCE,且移动速度大于FLING_MIN_VELOCITY个像素/秒
6. onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY):在屏幕上
拖动事件。无论是用手拖动view,或者是以抛的动作滚动,都会多次触发,这个方法在ACTION_MOVE动作发生时就会触发。
点击一下非常快的(不滑动)Touchup:
onDown->onSingleTapUp->onSingleTapConfirmed
点击一下稍微慢点的(不滑动)Touchup:
onDown->onShowPress->onSingleTapUp->onSingleTapConfirmed
onDown->onSingleTapUp->onSingleTapConfirmed
点击一下稍微慢点的(不滑动)Touchup:
onDown->onShowPress->onSingleTapUp->onSingleTapConfirmed
Demo
自定义Button控件,实现手势的监听和处理:
public class MyButton extends Button {
private GestureDetector mGesture;
private OnDoubleClickListener onDoubleClickListener;
//自定义监听器接口
interface OnDoubleClickListener{
void onDoubleClick(View view);
}
//设置双击事件监听器的方法
public void setOnDoubleClickListener(OnDoubleClickListener onDoubleClickListener){
this.onDoubleClickListener = onDoubleClickListener;
};
public MyButton(Context context) {
super(context);
}
public MyButton(final Context context, AttributeSet attrs) {
super(context, attrs);
//
mGesture = new GestureDetector(context,new GestureDetector.SimpleOnGestureListener(){
@Override
public boolean onDoubleTap(MotionEvent e) {
if(onDoubleClickListener!=null) {
onDoubleClickListener.onDoubleClick(MyButton.this);
}
Toast.makeText(context,"双击事件",Toast.LENGTH_SHORT).show();
return true;
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
/**
* 滑动和拖拽最好不要一起实现,会产生矛盾
*/
if(Math.abs(e1.getX()-e2.getX())>50){
setTranslationX(e2.getX() - e1.getX());
//根据手势滑动的距离而在水平方向上滑动控件
ObjectAnimator.ofFloat(MyButton.this,"translationX",getTranslationX(),e2.getX()-e1.getX())
.setDuration(500).start();
return true;
}
return super.onFling(e1, e2, velocityX, velocityY);
}
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
//根据手势拖拽控件的相位而移动控件
setTranslationX(getTranslationX()+e2.getX() - e1.getX());
setTranslationY(getTranslationX()+e2.getY() - e1.getY());
return super.onScroll(e1, e2, distanceX, distanceY);
}
});
}
public MyButton(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
if(event.getAction()==MotionEvent.ACTION_DOWN){
}
return super.dispatchTouchEvent(event);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
//touch事件传给onTouchEvent()
mGesture.onTouchEvent(event);
return super.onTouchEvent(event);
}
}- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
布局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.example.administrator.selfishgroupview.MyButton
android:id="@+id/button_doubleTap"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="点击"/>
</RelativeLayout>- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
主活动:
public class MainActivity extends Activity {
private MyButton myButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myButton = (MyButton) findViewById(R.id.button_doubleTap);
myButton.setOnDoubleClickListener(new MyButton.OnDoubleClickListener() {
@Override
public void onDoubleClick(View view) {
Log.d("","点击两次");
}
});
}
}- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
2015年10月6日星期二
Update API of top-feeds
I've updated "top-feeds" API for adding biggest Chinese Geek-Community.
Sample feeds: http://top-feeds2-91415.appspot.com/topfeeds?type=3&page=6:40577
See more on source.
Also the client SDK (TopFeeds4J) and client Android App have been updated.
Sample feeds: http://top-feeds2-91415.appspot.com/topfeeds?type=3&page=6:40577
See more on source.
Also the client SDK (TopFeeds4J) and client Android App have been updated.
订阅:
博文 (Atom)

