android.view.View#getHandler ( )源码实例Demo

下面列出了android.view.View#getHandler ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: MDPreference   文件: RippleManager.java
@Override
public void onClick(View v) {
	Drawable background = v.getBackground();
	long delay = 0;

	if(background != null) {
		if (background instanceof RippleDrawable)
			delay = ((RippleDrawable) background).getClickDelayTime();
		else if (background instanceof ToolbarRippleDrawable)
			delay = ((ToolbarRippleDrawable) background).getClickDelayTime();
	}
		
	if(delay > 0 && v.getHandler() != null && !mClickScheduled) {
           mClickScheduled = true;
           v.getHandler().postDelayed(new ClickRunnable(v), delay);
       }
	else
		dispatchClickEvent(v);
}
 
源代码2 项目: material   文件: RippleManager.java
@Override
public void onClick(View v) {
	Drawable background = v.getBackground();
	long delay = 0;

	if(background != null) {
		if (background instanceof RippleDrawable)
			delay = ((RippleDrawable) background).getClickDelayTime();
		else if (background instanceof ToolbarRippleDrawable)
			delay = ((ToolbarRippleDrawable) background).getClickDelayTime();
	}
		
	if(delay > 0 && v.getHandler() != null) {
		if(!mClickScheduled){
           			mClickScheduled = true;
           			v.getHandler().postDelayed(new ClickRunnable(v), delay);
		}
       	}
	else
		dispatchClickEvent(v);
}
 
源代码3 项目: xDrip   文件: FirstPageFragment.java
private void updateText(final View localView, final TextView tv, final String s) {
    Log.d("DrawStats", "updateText: " + s);
    Thread thread = new Thread(new Runnable() {
        @Override
        public void run() {

            //Adrian: after screen rotation it might take some time to attach the view to the window
            //Wait up to 3 seconds for this to happen.
            int i = 0;
            while (localView.getHandler() == null && i < 10) {
                i++;
                try {
                    Thread.sleep(300);
                } catch (InterruptedException e) {
                }

            }

            if (localView.getHandler() == null) {
                Log.d("DrawStats", "no Handler found - stopping to update view");
                return;
            }


            boolean success = localView.post(new Runnable() {
                @Override
                public void run() {
                    tv.setText(s);
                    Log.d("DrawStats", "setText actually called: " + s);

                }
            });
            Log.d("DrawStats", "updateText: " + s + " success: " + success);
        }
    });
    thread.start();

}
 
源代码4 项目: xDrip-plus   文件: FirstPageFragment.java
private void updateText(final View localView, final TextView tv, final String s) {
    Log.d("DrawStats", "updateText: " + s);
    Thread thread = new Thread(new Runnable() {
        @Override
        public void run() {

            //Adrian: after screen rotation it might take some time to attach the view to the window
            //Wait up to 3 seconds for this to happen.
            int i = 0;
            while (localView.getHandler() == null && i < 10) {
                i++;
                try {
                    Thread.sleep(300);
                } catch (InterruptedException e) {
                }

            }

            if (localView.getHandler() == null) {
                Log.d("DrawStats", "no Handler found - stopping to update view");
                return;
            }


            boolean success = localView.post(new Runnable() {
                @Override
                public void run() {
                    tv.setText(s);
                    Log.d("DrawStats", "setText actually called: " + s);

                }
            });
            Log.d("DrawStats", "updateText: " + s + " success: " + success);
        }
    });
    thread.start();

}
 
源代码5 项目: xDrip-Experimental   文件: FirstPageFragment.java
private void updateText(final View localView, final TextView tv, final String s) {
    Log.d("DrawStats", "updateText: " + s);
    Thread thread = new Thread(new Runnable() {
        @Override
        public void run() {

            //Adrian: after screen rotation it might take some time to attach the view to the window
            //Wait up to 3 seconds for this to happen.
            int i = 0;
            while (localView.getHandler() == null && i < 10) {
                i++;
                try {
                    Thread.sleep(300);
                } catch (InterruptedException e) {
                }

            }

            if (localView.getHandler() == null) {
                Log.d("DrawStats", "no Handler found - stopping to update view");
                return;
            }


            boolean success = localView.post(new Runnable() {
                @Override
                public void run() {
                    tv.setText(s);
                    Log.d("DrawStats", "setText actually called: " + s);

                }
            });
            Log.d("DrawStats", "updateText: " + s + " success: " + success);
        }
    });
    thread.start();

}
 
源代码6 项目: NightWatch   文件: FirstPageFragment.java
private void updateText(final View localView, final TextView tv, final String s) {
    Log.d("DrawStats", "updateText: " + s);
    Thread thread = new Thread(new Runnable() {
        @Override
        public void run() {

            //Adrian: after screen rotation it might take some time to attach the view to the window
            //Wait up to 3 seconds for this to happen.
            int i = 0;
            while (localView.getHandler() == null && i < 10) {
                i++;
                try {
                    Thread.sleep(300);
                } catch (InterruptedException e) {
                }

            }

            if (localView.getHandler() == null) {
                Log.d("DrawStats", "no Handler found - stopping to update view");
                return;
            }


            boolean success = localView.post(new Runnable() {
                @Override
                public void run() {
                    tv.setText(s);
                    Log.d("DrawStats", "setText actually called: " + s);

                }
            });
            Log.d("DrawStats", "updateText: " + s + " success: " + success);
        }
    });
    thread.start();

}
 
private void postCheckRegisterResultOnUiThread(final View view,
        final CheckInvalidator checkInvalidator, final int retry) {
    // Now posting on UI thread to access view methods.
    final Handler viewHandler = view.getHandler();
    if (viewHandler == null) return;
    viewHandler.post(new Runnable() {
        @Override
        public void run() {
            checkRegisterResult(view, checkInvalidator, retry);
        }
    });
}
 
源代码8 项目: NightWatch   文件: FirstPageFragment.java
private void updateText(final View localView, final TextView tv, final String s) {
    Log.d("DrawStats", "updateText: " + s);
    Thread thread = new Thread(new Runnable() {
        @Override
        public void run() {

            //Adrian: after screen rotation it might take some time to attach the view to the window
            //Wait up to 3 seconds for this to happen.
            int i = 0;
            while (localView.getHandler() == null && i < 10) {
                i++;
                try {
                    Thread.sleep(300);
                } catch (InterruptedException e) {
                }

            }

            if (localView.getHandler() == null) {
                Log.d("DrawStats", "no Handler found - stopping to update view");
                return;
            }


            boolean success = localView.post(new Runnable() {
                @Override
                public void run() {
                    tv.setText(s);
                    Log.d("DrawStats", "setText actually called: " + s);

                }
            });
            Log.d("DrawStats", "updateText: " + s + " success: " + success);
        }
    });
    thread.start();

}
 
 方法所在类
 同类方法