杂项16

SVN
删除包不方便,在资源管理器 手工删除 ,但是svn 不能同步了。以后应该谨慎手工删除文件。但是没有看到svn控制文件,被隐藏了。
重新检出


check for upgrade ,全部更新所有eclipse 包。
速度太慢。
应该可以单独更新,有个管理器,在 about install detail 。
为什么一直没有考虑这个问题。
eclipse 新特性带来的好处
可以学习到什么 。多思索。


Android事件处理分析
http://www.cnblogs.com/cnhome/archive/2010/03/24/1629435.html


onInterceptTouchEvent和onTouchEvent调用时序
http://blog.csdn.net/ddna/article/details/5473293


keyevent 监视 软键盘 ? 不应该
keyevent 传送 到 focus child view ? 




每个Activity 都要出来back 健


思维定势,一条路走死 用 listView ,注意需求,新的修改
 CameraMediaUtil.onMediaActivityResult(this , requestCode,  resultCode,  intent,true,150,150) ;
怪怪的,把requestCode 界面 加进去了。 方法要简单。封装了系统的封装,过分的重用。






setImage 做了太多的功能。不要考虑性能 ,浪费就浪费点。




一个Activity ,配一个model 。宁愿多点类,也要机构清楚。


定义 page 类。


网上也没有提到的系统问题,是我们自己的问题。


判断gameinfo 实例 就可以了。思路开放。(系统提供的功能,和自己的管理)


List 中 onTouch 事件处理。利用了onTouchUp() 


public boolean onTouch(View v, MotionEvent event) {
    if(event.getAction() == MotionEvent.ACTION_DOWN || 
        event.getAction() == MotionEvent.ACTION_MOVE)
    {
      mBtn.setImageBitmap(mBmp1);
    }
    else if(event.getAction() == MotionEvent.ACTION_UP ||
        event.getAction() == MotionEvent.ACTION_OUTSIDE)
    {
      mBtn.setImageBitmap(mBmp0);
    }




public void onTouchUp() {
if(!mIsEnable)
  return ;


mBtn.setImageBitmap(mBmp0);
}






内存问题,大内存对象释放 ,静态Activity 。
全局数据问题


scale 时, 怪异的 android BitmapFactory decodeStream 行为 。


全局数据
硬盘保存的,临时性全局访问的


理论上可以提供单个activity kill 。但是实际上只能kill proces。


save 在 onstop 的时候 ,就保存了。真正kill 的时候,无法保存任何信息。


如何定制 错误对话框,UI 线程可能已经死掉了。有些窗口,或者UI 方法可以在其他线程调用。
也许他们已经封装在 handle 里面了。




First, note there is a difference between setUncaughtExceptionHandler 
() and setDefaultUncaughtExceptionHandler().  One applies to a single 
thread, the other to all threads in the VM. 
Second, the app framework already provides a global uncaught exception 
handler.  The exception traces with the "AndroidRuntime" tag are 
generated here, and then the VM is killed.  See frameworks/base/core/ 
java/com/android/internal/os/RuntimeInit.java.  If you specify your 
own, you will override the app framework's behavior for all threads. 
how does he find these source code .




http://stackoverflow.com/questions/2681499/android-how-to-auto-restart-application-after-its-been-force-closed
http://stackoverflow.com/questions/601503/how-do-i-obtain-crash-data-from-my-android-application


Appliction  主线程可能已经死掉了,不如开个新程序,传个flag 给新程序。
intent = PendingIntent.getActivity(YourApplication.getInstance().getBaseContext(), 0,
            new Intent(getIntent()), getIntent().getFlags());
Than in your uncaughtException() method:


AlarmManager mgr = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 2000, intent);
System.exit(2);
Without calling System.exit() will not work. This code will restart your application after 2 seconds.
Eventually you can set some flag in your intent that the application crashed and in your onCreate() method you can show a dialog "I'm sorry, the application crashed, hope never again :)".


AlarmManager  和 PendingIntent
static PendingIntent getActivities (Context context, int requestCode, Intent[] intents, int flags)
set (int type, long triggerAtTime, PendingIntent operation)


if need not when appliction stop ,we should use  handle better than AlarmManager  
handle sendMessageAtTime(Message msg, long uptimeMillis)


dumpsys


Android in Hudson (0) 建置Hudson
http://www.dotblogs.com.tw/yuanchien/archive/2010/11/25/19706.aspx
hudson 持续集成工具




http://stackoverflow.com/questions/3121232/android-popup-window-dismissal
This is because the popup window does not respond to onTouch or onKey events unless it has a background that != null.
The reason the background cannot be null is because of what happens in PopupWindow#preparePopup. If it detects background != null it creates an instance of PopupViewContainer and calls setBackgroundDrawable on that and puts your content view in it. PopupViewContainer is basically a FrameLayout that listens for touch events and the KeyEvent.KEYCODE_BACK event to dismiss the window. If background == null, it doesn't do any of that and just uses your content view. You can, as an alternative to depending on PopupWindow to handle that, extend your root ViewGroup to behave the way you want.
缺省最简单的处理,还是 setbackdrawable 


事件处理  View dispatchKeyEvent
Activity dispatchKeyEvent is invoked by decoder view 。


getKeyDispatcherState().startTracking(event, this);处理 


if no popupViewContainer ,outside no response 然后定制,可能


http://zhanglimijavaeye.iteye.com/blog/981891
pop.setOutsideTouchable(true);//默认是false,控制pop是否监听pop以外的触屏事件。这个方法在pop可触,并且no focusable时有意义。这意味着在pop外点击屏幕,


 You might also need to call PopupWindow#setOutsideTouchable(true) if you want it to go away when the user clicks outside of the window boundaries.
 WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;
/** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you
 * can set this flag to receive a single special MotionEvent with
 * the action
 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for
 * touches that occur outside of your window.  Note that you will not
 * receive the full down/move/up gesture, only the location of the
 * first down as an ACTION_OUTSIDE.
 
 
     /**
     * Dispatch a key event to the next view on the focus path. This path runs
     * from the top of the view tree down to the currently focused view. If this
     * view has focus, it will dispatch to itself. Otherwise it will dispatch
     * the next node down the focus path. This method also fires any key
     * listeners.
     *
     * @param event The key event to be dispatched.
     * @return True if the event was handled, false otherwise.
     */
    public boolean dispatchKeyEvent(KeyEvent event) {
        // If any attached key listener a first crack at the event.
        //noinspection SimplifiableIfStatement


        if (android.util.Config.LOGV) {
            captureViewInfo("captureViewKeyEvent", this);
        }


        if (mOnKeyListener != null && (mViewFlags & ENABLED_MASK) == ENABLED
                && mOnKeyListener.onKey(this, event.getKeyCode(), event)) {
            return true;
        }


        return event.dispatch(this, mAttachInfo != null
                ? mAttachInfo.mKeyDispatchState : null, this);
    }
    
    
    
    
        /**
     * Pass the touch screen motion event down to the target view, or this
     * view if it is the target.
     *
     * @param event The motion event to be dispatched.
     * @return True if the event was handled by the view, false otherwise.
     */
    public boolean dispatchTouchEvent(MotionEvent event) {
        if (mOnTouchListener != null && (mViewFlags & ENABLED_MASK) == ENABLED &&
                mOnTouchListener.onTouch(this, event)) {
            return true;
        }
        return onTouchEvent(event);
    }
    }
    
    第一 先判断 enable 和  是否为空 ,可以快速 判断
    第二 先调用监听器,再调用自己的onTouchEvent 。




位运算,最快捷,底层API 用的最多。


所有的event 都只会dispatch 给 最前一个 view ?Browser 大小浮动按钮 ,是否只是Frame 前面的 view
http://www.eoeandroid.com/thread-71478-1-1.html
悬浮歌词(迷你歌词)效果解读 
直接加到 windowsmanager ,缺省的悬浮效果。


WindowManager.LayoutParams type




The general type of window. There are three main classes of window types:
Application windows (ranging from FIRST_APPLICATION_WINDOW to LAST_APPLICATION_WINDOW) are normal top-level application windows. For these types of windows, the token must be set to the token of the activity they are a part of (this will normally be done for you if token is null).
Sub-windows (ranging from FIRST_SUB_WINDOW to LAST_SUB_WINDOW) are associated with another top-level window. For these types of windows, the token must be the token of the window it is attached to.
System windows (ranging from FIRST_SYSTEM_WINDOW to LAST_SYSTEM_WINDOW) are special types of windows for use by the system for specific purposes. They should not normally be used by applications, and a special permission is required to use them.




By default a popup window is not focusable ,but is touch able 。


Controls whether the pop-up will be informed of touch events outside
     * of its window.  This only makes sense for pop-ups that are touchable
     * but not focusable, which means touches outside of the window will
     * be delivered to the window behind.  The default is false.
     
     缺省情况下,window 不会监听outside 事件。
     但是为什么 popup view 监听 需要 ,两个条件。


如果我们使用FrameLayout作为activity's content view的父元素(也就是在main.xml里把它写在最外层),那么可以考虑用<merge />替换<FrameLayout />标签。官方文档给出的解释是这样做可以减少一级布局层次达到优化布局的效果. 
merge  到 DecorView 


 attrs.flags = (attrs.flags&~mask) | (flags&mask);  flag 可能有多位数据, mask 可以某一位


floating
     * @return Returns true if the window is configured to be displayed floating
     * on top of whatever is behind it.


    /**
     * Set the gravity of the window, as per the Gravity constants.  This
     * controls how the window manager is positioned in the overall window; it
     * is only useful when using WRAP_CONTENT for the layout width or height.
     * @param gravity The desired gravity constant.
     */
    public void setGravity(int gravity)
    {
        final WindowManager.LayoutParams attrs = getAttributes();
        attrs.gravity = gravity;
        if (mCallback != null) {
            mCallback.onWindowAttributesChanged(attrs);
        }
    }




    /**
     * Enable extended screen features.  This must be called before
     * setContentView().  May be called as many times as desired as long as it
     * is before setContentView().  If not called, no extended features
     * will be available.  You can not turn off a feature once it is requested.
     * You canot use other title features with {@link #FEATURE_CUSTOM_TITLE}.
     *
     * @param featureId The desired features, defined as constants by Window.
     * @return The features that are now set.
     */
    public boolean requestFeature(int featureId) {
        final int flag = 1<<featureId;
        mFeatures |= flag;
        mLocalFeatures |= mContainer != null ? (flag&~mContainer.mFeatures) : flag;
        return (mFeatures&flag) != 0;
    }


setFlag


window callback 


WindowManager.LayoutParams 
flag 后台窗口,事件处理 ,亮度,大小位置,透明
type 窗口类型


token IBinder  ,支持远程,Context 不是IBinder 。


parcel Container for a message (data and object references) that can
 * be sent through an IBinder. it is for RPC and it is like bundle 。
parcelable


onlowmemory


 onSaveInstanceState()


onResume 
 This method is typically used to commit unsaved changes to persistent data, stop animations and other things that may be consuming CPU, and so on. It should do whatever it does very quickly, because the next activity will not be resumed until it returns.
The column labeled "Killable after?" indicates whether or not the system can kill the process hosting the activity at any time after the method returns 。
if pause is killed ,how to dispaly it ?


模拟器 host 错误




08-31 07:46:22.161: DEBUG/NetManager(275): Json output String: {"maindo":1,"subdo":2,"sult":{"uid":"100027","username":"a71111","nickname":"\u82cd\u8001\u5e08gnl","realname":"\u82cd\u8001\u5e08","headpicid":"1","isvip":"0","sex":"1","email":"","mobile":"","qq":"0","msn":"","address":"","homepage":"","zipcode":"","phone":"","regip":"0.0.0.0","regdate":"2011-08-29 00:42:08","lastloginip":"","lastlogintime":"2011-08-31 07:39:37","sys_config":{"heartbeat_time":60,"clear_out_session_time":600,"alow_more_login":1,"admin_user_id":100007},"headpic_id":"1","headpic_url":"1.png","headpic_surl":"1.png","message":[],"sn":"28a97469379f9234508bebebb0be02f4"}}




android framework


Util 
IO
Model View 
NetLoader


文件管理器


09-01 03:19:51.335: ERROR/AndroidRuntime(364): java.util.ConcurrentModificationException
09-01 03:19:51.335: ERROR/AndroidRuntime(364):     at java.util.AbstractList$SubAbstractList.size(AbstractList.java:366)
09-01 03:19:51.335: ERROR/AndroidRuntime(364):     at java.util.AbstractCollection.toArray(AbstractCollection.java:340)
09-01 03:19:51.335: ERROR/AndroidRuntime(364):     at java.util.ArrayList.addAll(ArrayList.java:193)








progress bug ,cancel 后要减掉1 。


如何写testcase 


mantis and SVN  集成


设计的缺陷,网络状态预设。
cache 可以集成起来,但是 refresh 。


全部重改,以后这方面性能不是问题。




淘金岛 新版本
社区修复了 
进度条有时候无法关闭
修改用户资料时候,硬键盘输入无效,
大数据量更多保护等问题,
以及删除部分 无用code 。


斗地主修复了 在说明中报名出错的问题。




email 服务器端 直接截取长度了


Office Excel 的 redo undo ,插入时候覆盖


浏览器 取消 progress 。


虚拟物品加上未开发提示
兑换奖品 支持 硬键盘
修改 电话硬键盘输入问题




点击兑换椰果按钮 进入兑换椰果页面
点击赠送按钮 进入赠送椰果页面




我的信息 有 bug  




Handle 处理 ,延时是它的一个用处




corner case , 恶意攻击的只要考虑安全性,而不需要考虑用户体验。


用户体验的一致。每个都要改。


ListView ,动态增加,数据库


http://man.ddvip.com/program/java_api_zh/index.html?java/math/RoundingMode.html




2.1 系统 崩溃


list view 处理 不要用static ,一般都能回收。


bug 分析


AUTO_LOGIN 名字 不清晰, 应该是注销的地方调用 NotSupportAutoLogin 。 清楚的名字,而不是笼统的名字


Intent.FLAG_ACTIVITY_CLEAR_TOP & intent.getFlags()) != 0)




ViewAnimation  need UI handle 。


被电话打断到后台后,dialog 不受到影响,toast 还会显示。
打电话时候,媒体声音会关闭。


如何把窗口打开到顶部。


Attaching event onWindowVisibilityChanged(int)
onWindowFocusChanged(boolean)


onTrackballEvent (MotionEvent event)
InputEvent
KeyEvent
KeyEvent(long downTime, long eventTime, int action, int code, int repeat, int metaState, int deviceId, int scancode, int flags, int source)
常用的下面
 acttion ,   ,keycode,FLAG_LONG_PRESS 。
keycode 包含很多code 
MotionEvent 无构造器?
View 两种event ,三个dispatch , 四个事件,多个listener 。
TraceBall  轨迹球 ,能否有鼠标光标
笔记本 触摸板


if (ViewDebug.TRACE_HIERARCHY) {
    ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE);
}
debug 信息


View position getLeft ()
Left position of this view relative to its parent.


Building Custom Components  ,三种。  还有不继承的组合,工厂方法创建。
淘金岛ListView , 可以定义一个component 。(复合的,还是继承listView ) ,闭合原则。


如何加入search 功能。抽象的component 加一个 clearAdd 功能。现在是直接访问OrderAdapter 。


很少用的,放在setField 里面。而不是构建里面 但是容易忘掉。(也可以定义多个构建器,既使用简单,又支持扩展)。


重构code 
注意方法顺序,code stytle 。便于阅读。 有层次,顺序。
IDE 辅助Outline ,ctl +o 有field ,折叠code 。


Addview layout 缺省值
showNext 从其他线程,调用没有反应。应该有报错。
resource 

Listview 滚动速度 由scroll 控制,不易定制。


如何用 abstract int getItemViewType (int position) 来重构。不用也可以。共用一个罢了。


smoothScrollToPosition(int position) 。平滑滚动,和select 直接跳转不一样。
setSelectionFromTop(int position, int y)
getFirstVisiblePosition()
滚动事件


ListView 手势
这样试试@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
        // TODO Auto-generated method stub
        super.dispatchTouchEvent(ev);
        return tgestureDetector.onTouchEvent(ev);
}
return GestureDetector.onTouchEvent(event);  
OnDoubleTapListener
http://wayfarer.iteye.com/blog/460284
Android Gesture Detector
http://blog.csdn.net/cgipro/article/details/5737631
scroll ,tap ,longclick ,fling (快速的,有速度参赛)




ontouch 不一定在view 的location 。但是缺省情况下 会做一个 if (frame.contains(scrolledXInt, scrolledYInt)) {




具体 logic 见 View group dispatchTouchEvent ,都是在这处理。
先处理listener 。也可能consumed 掉。
onInterceptTouchEvent 
http://blog.csdn.net/ddna/article/details/5473293
缺省不拦截,都是先给child 处理,如果child 不处理(只要down 不处理),再自己处理。
拦截后,如果 连down 拦截,target 为空,那就直接调用自己的touch ,有 target ,传给target cancel ,
 Don't dispatch this event to our own view, because we already
            // saw it when intercepting;
缺省情况我们不需拦截,特殊情况下才需要。
ListView 会拦截吗?
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章