Java Code Examples for android.view.View.OnTouchListener

The following are top voted examples for showing how to use android.view.View.OnTouchListener. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: GitHub   File: BottomMenuWindow.java   View source code 7 votes vote down vote up
@Override
public void initEvent() {//必须调用
	super.initEvent();

	lvBottomMenu.setOnItemClickListener(this);
	
	vBaseBottomWindowRoot.setOnTouchListener(new OnTouchListener() {
		
		@SuppressLint("ClickableViewAccessibility")
		@Override
		public boolean onTouch(View v, MotionEvent event) {
			finish();
			return true;
		}
	});
}
 
Example 2
Project: GitHub   File: BaseActivity.java   View source code 6 votes vote down vote up
/**设置该Activity界面布局,并设置底部左右滑动手势监听
 * @param layoutResID
 * @param listener
 * @use 在子类中
 * *1.onCreate中super.onCreate后setContentView(layoutResID, this);
 * *2.重写onDragBottom方法并实现滑动事件处理
 * *3.在导航栏左右按钮的onClick事件中调用onDragBottom方法
 */
public void setContentView(int layoutResID, OnBottomDragListener listener) {
	setContentView(layoutResID);

	onBottomDragListener = listener;
	gestureDetector = new GestureDetector(this, this);//初始化手势监听类

	view = inflater.inflate(layoutResID, null);
	view.setOnTouchListener(new OnTouchListener() {
		
		@SuppressLint("ClickableViewAccessibility")
		@Override
		public boolean onTouch(View v, MotionEvent event) {
			return gestureDetector.onTouchEvent(event);
		}
	});
}
 
Example 3
Project: GitHub   File: BaseActivity.java   View source code 6 votes vote down vote up
/**设置该Activity界面布局,并设置底部左右滑动手势监听
 * @param layoutResID
 * @param listener
 * @use 在子类中
 * *1.onCreate中super.onCreate后setContentView(layoutResID, this);
 * *2.重写onDragBottom方法并实现滑动事件处理
 * *3.在导航栏左右按钮的onClick事件中调用onDragBottom方法
 */
public void setContentView(int layoutResID, OnBottomDragListener listener) {
	setContentView(layoutResID);

	onBottomDragListener = listener;
	gestureDetector = new GestureDetector(this, this);//初始化手势监听类

	view = inflater.inflate(layoutResID, null);
	view.setOnTouchListener(new OnTouchListener() {
		
		@SuppressLint("ClickableViewAccessibility")
		@Override
		public boolean onTouch(View v, MotionEvent event) {
			return gestureDetector.onTouchEvent(event);
		}
	});
}
 
Example 4
Project: GitHub   File: BottomMenuWindow.java   View source code 6 votes vote down vote up
@Override
public void initEvent() {//必须调用
	super.initEvent();

	lvBottomMenu.setOnItemClickListener(this);
	
	vBaseBottomWindowRoot.setOnTouchListener(new OnTouchListener() {
		
		@SuppressLint("ClickableViewAccessibility")
		@Override
		public boolean onTouch(View v, MotionEvent event) {
			finish();
			return true;
		}
	});
}
 
Example 5
Project: APIJSON-Android-RxJava   File: BaseActivity.java   View source code 6 votes vote down vote up
/**设置该Activity界面布局,并设置底部左右滑动手势监听
 * @param layoutResID
 * @param listener
 * @use 在子类中
 * *1.onCreate中super.onCreate后setContentView(layoutResID, this);
 * *2.重写onDragBottom方法并实现滑动事件处理
 * *3.在导航栏左右按钮的onClick事件中调用onDragBottom方法
 */
public void setContentView(int layoutResID, OnBottomDragListener listener) {
	setContentView(layoutResID);

	onBottomDragListener = listener;
	gestureDetector = new GestureDetector(this, this);//初始化手势监听类

	view = inflater.inflate(layoutResID, null);
	view.setOnTouchListener(new OnTouchListener() {

		@SuppressLint("ClickableViewAccessibility")
		@Override
		public boolean onTouch(View v, MotionEvent event) {
			return gestureDetector.onTouchEvent(event);
		}
	});
}
 
Example 6
Project: APIJSON-Android-RxJava   File: BottomMenuWindow.java   View source code 6 votes vote down vote up
@Override
public void initEvent() {//必须调用
	super.initEvent();

	lvBottomMenu.setOnItemClickListener(this);
	
	vBaseBottomWindowRoot.setOnTouchListener(new OnTouchListener() {
		
		@SuppressLint("ClickableViewAccessibility")
		@Override
		public boolean onTouch(View v, MotionEvent event) {
			finish();
			return true;
		}
	});
}
 
Example 7
Project: qmui   File: QMUIBasePopup.java   View source code 6 votes vote down vote up
/**
 * Constructor.
 *
 * @param context Context
 */
public QMUIBasePopup(Context context) {
    mContext = context;
    mWindow = new PopupWindow(context);
    mWindow.setTouchInterceptor(new OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                mWindow.dismiss();
                return false;
            }
            return false;
        }
    });

    mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);

}
 
Example 8
Project: NoticeDog   File: OverlayNotificationController.java   View source code 6 votes vote down vote up
@Inject
void init() {
    this.notificationBarView = (OverlayNotificationBarView) ((LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.overlay_notification_bar, null);
    this.notificationTouchListener = new View(this.context);
    this.notificationTouchListener.setOnTouchListener(new OnTouchListener() {
        public boolean onTouch(View v, MotionEvent event) {
            return OverlayNotificationController.this.notificationBarView.dispatchTouchEvent(event);
        }
    });
    this.notificationBarView.addListener((Object) this, new NotificationViewListener() {
        public void onNotificationViewClosed() {
            OverlayNotificationController.this.removeFromWindow();
            OverlayNotificationController.this.fireOnNotificationClosed();
        }
    });
}
 
Example 9
Project: NoticeDog   File: ShadeNotificationController.java   View source code 6 votes vote down vote up
@Inject
void init() {
    this.notificationBarView = (ShadeNotificationBarView) ((LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.shade_notification_bar, null);
    this.notificationTouchListener = new View(this.context);
    this.notificationTouchListener.setOnTouchListener(new OnTouchListener() {
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == 1) {
                Rect viewRect = new Rect();
                v.getHitRect(viewRect);
                if (viewRect.contains(Math.round(v.getX() + event.getX()), Math.round(v.getY() + event.getY()))) {
                    ShadeNotificationController.this.fireOsnNotificationTouched();
                    ShadeNotificationController.this.notificationBarView.closePopup();
                }
            }
            return true;
        }
    });
    this.notificationBarView.addListener((Object) this, new ShadeNotificationBarView.NotificationViewListener() {
        public void onNotificationViewClosed() {
            ShadeNotificationController.this.removeFromWindow();
            ShadeNotificationController.this.fireOnNotificationClosed();
        }
    });
}
 
Example 10
Project: PaoMovie   File: SendPaoPaoPic.java   View source code 6 votes vote down vote up
void ClickFalse(float progress) {
	if (progress == 0) {
		uploadProgress.setVisibility(View.VISIBLE);
		uploadProgress.setOnTouchListener(new OnTouchListener() {

			@Override
			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				return true;
			}
		});
	} else if (progress == 100) {
		uploadProgress.setVisibility(View.GONE);
		uploadProgress.setOnTouchListener(null);
	}
}
 
Example 11
Project: PaoMovie   File: SendPaoPaoAudio.java   View source code 6 votes vote down vote up
void ClickFalse(float progress) {
	if (progress == 0) {
		uploadProgress.setVisibility(View.VISIBLE);
		uploadProgress.setOnTouchListener(new OnTouchListener() {

			@Override
			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				return true;
			}
		});
	} else if (progress == 100) {
		uploadProgress.setVisibility(View.GONE);
		uploadProgress.setOnTouchListener(null);
	}
}
 
Example 12
Project: MinimalismJotter   File: BasePopupWindowForListView.java   View source code 6 votes vote down vote up
public BasePopupWindowForListView(View contentView, int width, int height,
                                  boolean focusable, List<T> mDatas, Object... params) {
    super(contentView, width, height, focusable);
    this.mContentView = contentView;
    context = contentView.getContext();
    if (mDatas != null)
        this.mDatas = mDatas;

    if (params != null && params.length > 0) {
        beforeInitWeNeedSomeParams(params);
    }

    setBackgroundDrawable(new BitmapDrawable());
    setTouchable(true);
    setOutsideTouchable(true);
    setTouchInterceptor(new OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                dismiss();
                return true;
            }
            return false;
        }
    });
    initViews();
    initEvents();
    init();
}
 
Example 13
Project: buildAPKsApps   File: TrainingActivity.java   View source code 6 votes vote down vote up
private void configureButtons() {
    // Buttons control only interactive training session (they are hidden
    // during automatic training session).
    recordButton.setOnTouchListener(new OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_DOWN) {
                interactiveTrainingController.record();
            } else if (event.getAction() == MotionEvent.ACTION_UP) {
                interactiveTrainingController.play();
            }
            return false;
        }
    });

    replayButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View arg) {
            if (replayButton.isEnabled()) {
                interactiveTrainingController.play();
            }
        }
    });
}
 
Example 14
Project: KTalk   File: EaseChatFragment.java   View source code 6 votes vote down vote up
protected void onMessageListInit(){
    messageList.init(toChatUsername, chatType, chatFragmentHelper != null ? 
            chatFragmentHelper.onSetCustomChatRowProvider() : null);
    setListItemClickListener();
    
    messageList.getListView().setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            hideKeyboard();
            inputMenu.hideExtendMenuContainer();
            return false;
        }
    });
    
    isMessageListInited = true;
}
 
Example 15
Project: Tribe   File: EaseChatFragment.java   View source code 6 votes vote down vote up
protected void onMessageListInit(){
    messageList.init(toChatUsername, chatType, chatFragmentHelper != null ? 
            chatFragmentHelper.onSetCustomChatRowProvider() : null);
    setListItemClickListener();
    
    messageList.getListView().setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            hideKeyboard();
            inputMenu.hideExtendMenuContainer();
            return false;
        }
    });
    
    isMessageListInited = true;
}
 
Example 16
Project: OSchina_resources_android   File: BrowserFragment.java   View source code 6 votes vote down vote up
@Override
public void initView(View view) {
    initWebView();
    initBarAnim();
    mImgBack.setOnClickListener(this);
    mImgForward.setOnClickListener(this);
    mImgRefresh.setOnClickListener(this);
    mImgSystemBrowser.setOnClickListener(this);

    mGestureDetector = new GestureDetector(aty, new MyGestureListener());
    mWebView.loadUrl(mCurrentUrl);
    mWebView.setOnTouchListener(new OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            return mGestureDetector.onTouchEvent(event);
        }
    });
}
 
Example 17
Project: FloatingApps   File: MenuItem.java   View source code 6 votes vote down vote up
public LinearLayout show() {
    final LinearLayout mainLayout = new LinearLayout(this.ctx);
    final MenuItem that = this;
    this.articleView.setOnTouchListener(new OnTouchListener() {
        public boolean onTouch(View v, MotionEvent event) {
            if(event.getAction() == MotionEvent.ACTION_DOWN) {
                mainLayout.setBackgroundColor(Color.parseColor("#EEEEEE"));
            }
            if(event.getAction() == MotionEvent.ACTION_UP) {
                mainLayout.setBackgroundColor(Color.WHITE);
                if(event.getX() > 0 && event.getY() > 0 && event.getX() < Utils.dip2px(that.ctx, 200) && event.getY() < Utils.dip2px(that.ctx, 25)) {
                    if(that.listener != null) that.listener.onClick(v);
                }
            }
            return true;
        }
    });
    mainLayout.setOrientation(0);
    mainLayout.setLayoutParams(new LinearLayout.LayoutParams(Utils.dip2px(this.ctx, 200), Utils.dip2px(this.ctx, 25)));
    mainLayout.addView(this.iconView);
    mainLayout.addView(this.articleView);
    return mainLayout;
}
 
Example 18
Project: StarchWindow   File: MenuItem.java   View source code 6 votes vote down vote up
public LinearLayout show() {
     final LinearLayout mainLayout = new LinearLayout(this.ctx);
     final MenuItem that = this;
     this.articleView.setOnTouchListener(new OnTouchListener() {
	public boolean onTouch(View v, MotionEvent event) {
		if(event.getAction() == MotionEvent.ACTION_DOWN) {
			mainLayout.setBackgroundColor(Color.parseColor("#EEEEEE"));
		}
		if(event.getAction() == MotionEvent.ACTION_UP) {
			mainLayout.setBackgroundColor(Color.WHITE);
			if(event.getX() > 0 && event.getY() > 0 && event.getX() < Utils.dip2px(that.ctx, 200) && event.getY() < Utils.dip2px(that.ctx, 25)) {
				if(that.listener != null) that.listener.onClick(v);
			}
		}
		return true;
	}
});
     mainLayout.setOrientation(0);
     mainLayout.setLayoutParams(new LinearLayout.LayoutParams(Utils.dip2px(this.ctx, 200), Utils.dip2px(this.ctx, 25)));
     mainLayout.addView(this.iconView);
     mainLayout.addView(this.articleView);
     return mainLayout;
 }
 
Example 19
Project: FanChat   File: EaseChatFragment.java   View source code 6 votes vote down vote up
protected void onMessageListInit(){
    messageList.init(toChatUsername, chatType, chatFragmentHelper != null ? 
            chatFragmentHelper.onSetCustomChatRowProvider() : null);
    setListItemClickListener();
    
    messageList.getListView().setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            hideKeyboard();
            inputMenu.hideExtendMenuContainer();
            return false;
        }
    });
    
    isMessageListInited = true;
}
 
Example 20
Project: boohee_v5.6   File: PopupMenu.java   View source code 6 votes vote down vote up
public OnTouchListener getDragToOpenListener() {
    if (this.mDragListener == null) {
        this.mDragListener = new ForwardingListener(this.mAnchor) {
            protected boolean onForwardingStarted() {
                PopupMenu.this.show();
                return true;
            }

            protected boolean onForwardingStopped() {
                PopupMenu.this.dismiss();
                return true;
            }

            public ListPopupWindow getPopup() {
                return PopupMenu.this.mPopup.getPopup();
            }
        };
    }
    return this.mDragListener;
}
 
Example 21
Project: GravityBox   File: QsDetailItemsList.java   View source code 6 votes vote down vote up
private QsDetailItemsList(LinearLayout view) {
    mView = view;

    mListView = (ListView) mView.findViewById(android.R.id.list);
    mListView.setOnTouchListener(new OnTouchListener() {
        // Setting on Touch Listener for handling the touch inside ScrollView
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            // Disallow the touch request for parent scroll on touch of child view
            v.getParent().requestDisallowInterceptTouchEvent(true);
            return false;
        }
    });
    mEmpty = mView.findViewById(android.R.id.empty);
    mEmpty.setVisibility(View.GONE);
    mEmptyText = (TextView) mEmpty.findViewById(android.R.id.title);
    mEmptyIcon = (ImageView) mEmpty.findViewById(android.R.id.icon);
    mListView.setEmptyView(mEmpty);
}
 
Example 22
Project: QMUI_Android   File: QMUIBasePopup.java   View source code 6 votes vote down vote up
/**
 * Constructor.
 *
 * @param context Context
 */
public QMUIBasePopup(Context context) {
    mContext = context;
    mWindow = new PopupWindow(context);
    mWindow.setTouchInterceptor(new OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                mWindow.dismiss();
                return false;
            }
            return false;
        }
    });

    mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);

}
 
Example 23
Project: GCSApp   File: EaseChatFragment.java   View source code 6 votes vote down vote up
protected void onMessageListInit() {
    messageList.init(toChatUsername, chatType, chatFragmentHelper != null ?
            chatFragmentHelper.onSetCustomChatRowProvider() : null);
    setListItemClickListener();

    messageList.getListView().setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            hideKeyboard();
            inputMenu.hideExtendMenuContainer();
            return false;
        }
    });

    messageList.setIRcBack(this);
    isMessageListInited = true;
}
 
Example 24
Project: SlideDrawerHelper   File: SlideDrawerHelper.java   View source code 6 votes vote down vote up
/**
 * @param builder SlideDrawerHelper建造者
 */
private SlideDrawerHelper(@NonNull Builder builder) {
    ViewGroup dragLayout = builder.dragLayout;// 滑动触发布局,可拖动或点击
    this.slideParentLayout = builder.slideParentLayout;
    this.minHeight = builder.minHeight;
    this.mediumHeight = builder.mediumHeight;
    this.maxHeight = builder.maxHeight;
    this.animDuration = builder.animDuration;
    this.removeMediumHeightState = builder.removeMediumHeightState;
    this.clickSlidable = builder.clickSlidable;
    this.mediumClickSlideState = builder.mediumClickSlideState;
    dragLayout.setOnTouchListener(new OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            handleSlide(event);
            return true;
        }
    });
}
 
Example 25
Project: aos-MediaLib   File: CustomPopupWindow.java   View source code 6 votes vote down vote up
/**
    * Create a QuickAction
    * 
    * @param anchor
    *            the view that the QuickAction will be displaying 'from'
    */
public CustomPopupWindow(View anchor) {
    this.anchor = anchor;
    this.window = new PopupWindow(anchor.getContext());

    // when a touch even happens outside of the window
    // make the window go away
    window.setTouchInterceptor(new OnTouchListener() {
        public boolean onTouch(View v, MotionEvent event) {
            // FIXME : the setOutsideTouchable flag is set but it seems we never get ACTION_OUTSIDE events
            if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                CustomPopupWindow.this.window.dismiss();
                return true;
            }
            
            return false;
        }
    });

    windowManager = (WindowManager) anchor.getContext().getSystemService(Context.WINDOW_SERVICE);
    
    onCreate();
}
 
Example 26
Project: Android-AlarmManagerClock   File: SelectRemindCyclePopup.java   View source code 6 votes vote down vote up
@SuppressWarnings("deprecation")
public SelectRemindCyclePopup(Context context) {
    mContext = context;
    mPopupWindow = new PopupWindow(context);
    mPopupWindow.setBackgroundDrawable(new BitmapDrawable());
    mPopupWindow.setWidth(WindowManager.LayoutParams.FILL_PARENT);
    mPopupWindow.setHeight(WindowManager.LayoutParams.FILL_PARENT);
    mPopupWindow.setTouchable(true);
    mPopupWindow.setFocusable(true);
    mPopupWindow.setOutsideTouchable(true);
    mPopupWindow.setAnimationStyle(R.style.AnimBottom);
    mPopupWindow.setContentView(initViews());
    mPopupWindow.getContentView().setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            mPopupWindow.setFocusable(false);
            // mPopupWindow.dismiss();
            return true;
        }
    });

}
 
Example 27
Project: Android-AlarmManagerClock   File: SelectRemindWayPopup.java   View source code 6 votes vote down vote up
@SuppressWarnings("deprecation")
public SelectRemindWayPopup(Context context) {
    mContext = context;
    mPopupWindow = new PopupWindow(context);
    mPopupWindow.setBackgroundDrawable(new BitmapDrawable());
    mPopupWindow.setWidth(WindowManager.LayoutParams.FILL_PARENT);
    mPopupWindow.setHeight(WindowManager.LayoutParams.FILL_PARENT);
    mPopupWindow.setTouchable(true);
    mPopupWindow.setFocusable(true);
    mPopupWindow.setOutsideTouchable(true);
    mPopupWindow.setAnimationStyle(R.style.AnimBottom);
    mPopupWindow.setContentView(initViews());

    mPopupWindow.getContentView().setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            mPopupWindow.setFocusable(false);
            mPopupWindow.dismiss();
            return true;
        }
    });

}
 
Example 28
Project: empeg-remote   File: PopupWindows.java   View source code 6 votes vote down vote up
public PopupWindows(Context context) {
	mContext = context;
	mWindow = new PopupWindow(context);

	mWindow.setTouchInterceptor(new OnTouchListener() {
		@Override
		public boolean onTouch(View v, MotionEvent event) {
			if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
				mWindow.dismiss();
				return true;
			}
			return false;
		}
	});

	mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
}
 
Example 29
Project: Simple-Japanese-Gojuon   File: PopupWindows.java   View source code 6 votes vote down vote up
/**
 * Constructor.
 * 
 * @param context Context
 */
public PopupWindows(Context context) {
	mContext	= context;
	mWindow 	= new PopupWindow(context);

	mWindow.setTouchInterceptor(new OnTouchListener() {
		@Override
		public boolean onTouch(View v, MotionEvent event) {
			if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
				mWindow.dismiss();
				
				return true;
			}
			
			return false;
		}
	});

	mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
}
 
Example 30
Project: APIJSON   File: BaseActivity.java   View source code 6 votes vote down vote up
/**设置该Activity界面布局,并设置底部左右滑动手势监听
 * @param layoutResID
 * @param listener
 * @use 在子类中
 * *1.onCreate中super.onCreate后setContentView(layoutResID, this);
 * *2.重写onDragBottom方法并实现滑动事件处理
 * *3.在导航栏左右按钮的onClick事件中调用onDragBottom方法
 */
public void setContentView(int layoutResID, OnBottomDragListener listener) {
	setContentView(layoutResID);

	onBottomDragListener = listener;
	gestureDetector = new GestureDetector(this, this);//初始化手势监听类

	view = inflater.inflate(layoutResID, null);
	view.setOnTouchListener(new OnTouchListener() {

		@SuppressLint("ClickableViewAccessibility")
		@Override
		public boolean onTouch(View v, MotionEvent event) {
			return gestureDetector.onTouchEvent(event);
		}
	});
}
 
Example 31
Project: APIJSON   File: BottomMenuWindow.java   View source code 6 votes vote down vote up
@Override
public void initEvent() {//必须调用
	super.initEvent();

	lvBottomMenu.setOnItemClickListener(this);
	
	vBaseBottomWindowRoot.setOnTouchListener(new OnTouchListener() {
		
		@SuppressLint("ClickableViewAccessibility")
		@Override
		public boolean onTouch(View v, MotionEvent event) {
			finish();
			return true;
		}
	});
}
 
Example 32
Project: MeifuGO   File: EaseChatFragment.java   View source code 6 votes vote down vote up
protected void onMessageListInit(){
    messageList.init(toChatUsername, chatType, chatFragmentListener != null ? 
            chatFragmentListener.onSetCustomChatRowProvider() : null);
    //设置list item里的控件的点击事件
    setListItemClickListener();
    
    messageList.getListView().setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            hideKeyboard();
            inputMenu.hideExtendMenuContainer();
            return false;
        }
    });
    
    isMessageListInited = true;
}
 
Example 33
Project: darksms   File: CustomPopupWindow.java   View source code 6 votes vote down vote up
public CustomPopupWindow(View anchor) {
	this.anchor = anchor;
	this.window = new PopupWindow(anchor.getContext());

	// Если происходит прикосновение за пределами диалогового окна,то окно закрывается
	window.setTouchInterceptor(new OnTouchListener() {
		public boolean onTouch(View v, MotionEvent event) {
			if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
				CustomPopupWindow.this.window.dismiss();
				
				return true;
			}
			
			return false;
		}
	});

	windowManager = (WindowManager) anchor.getContext().getSystemService(Context.WINDOW_SERVICE);
	
	onCreate();
}
 
Example 34
Project: yun2win-sdk-android   File: Y2wDialog.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	me = this;
	this.setContentView(R.layout.dialog_message);
	rl_view = (RelativeLayout) findViewById(R.id.rl_message_dialog);
	lv_option = (ListView) findViewById(R.id.lv_message_deal);
	rl_view.setOnTouchListener(new OnTouchListener() {

		@Override
		public boolean onTouch(View arg0, MotionEvent arg1) {
			me.cancel();
			return false;
		}
	});
	/*WindowManager.LayoutParams lp=getWindow().getAttributes();
	lp.alpha = 0.9f;//透明度设置
	getWindow().setAttributes(lp);*/
	optionShow();
}
 
Example 35
Project: yun2win-sdk-android   File: AvDialog.java   View source code 6 votes vote down vote up
@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      me = this;
      this.setContentView(R.layout.dialog_av);
      rl_view = (RelativeLayout) findViewById(R.id.rl_av_dialog);
      lv_option = (ListView) findViewById(R.id.lv_av_option);
      rl_view.setOnTouchListener(new OnTouchListener() {

          @Override
          public boolean onTouch(View arg0, MotionEvent arg1) {
              me.cancel();
              return false;
          }
      });
      stateList = new ArrayList<NameState>();
/*WindowManager.LayoutParams lp=getWindow().getAttributes();
lp.alpha = 0.9f;//透明度设置
getWindow().setAttributes(lp);*/
      optionShow();
  }
 
Example 36
Project: monolog-android   File: EaseChatFragment.java   View source code 6 votes vote down vote up
protected void onMessageListInit(){
    messageList.init(toChatUsername, chatType, chatFragmentListener != null ? 
            chatFragmentListener.onSetCustomChatRowProvider() : null);
    //设置list item里的控件的点击事件
    setListItemClickListener();
    
    messageList.getListView().setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            hideKeyboard();
            inputMenu.hideExtendMenuContainer();
            return false;
        }
    });
    
    isMessageListInited = true;
}
 
Example 37
Project: Toolbar   File: PopupWindows.java   View source code 6 votes vote down vote up
public PopupWindows(Context context) {
    mContext = context;
    mWindow = new PopupWindow(context);

    //触摸消失
    mWindow.setTouchInterceptor(new OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                mWindow.dismiss();
                return true;
            }

            return false;
        }
    });

    mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
}
 
Example 38
Project: XPPLE_IM   File: ContactFragment.java   View source code 6 votes vote down vote up
private void initListView() {
	list_friends = (ListView) findViewById(R.id.list_friends);
	userAdapter = new UserFriendAdapter(getActivity(), friends);
	list_friends.setAdapter(userAdapter);
	list_friends.setOnItemClickListener(this);
	list_friends.setOnItemLongClickListener(this);

	list_friends.setOnTouchListener(new OnTouchListener() {

		@SuppressLint("ClickableViewAccessibility")
		@Override
		public boolean onTouch(View v, MotionEvent event) {
			// 隐藏软键盘
			if (getActivity().getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
				if (getActivity().getCurrentFocus() != null)
					inputMethodManager.hideSoftInputFromWindow(
							getActivity().getCurrentFocus()
									.getWindowToken(),
							InputMethodManager.HIDE_NOT_ALWAYS);
			}
			return false;
		}
	});

}
 
Example 39
Project: Hyphenate-EaseUI-Android   File: EaseChatFragment.java   View source code 6 votes vote down vote up
protected void onMessageListInit(){
    messageList.init(toChatUsername, chatType, chatFragmentHelper != null ? 
            chatFragmentHelper.onSetCustomChatRowProvider() : null);
    setListItemClickListener();
    
    messageList.getListView().setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            hideKeyboard();
            inputMenu.hideExtendMenuContainer();
            return false;
        }
    });
    
    isMessageListInited = true;
}
 
Example 40
Project: Doctor   File: PopupWindows.java   View source code 6 votes vote down vote up
public PopupWindows(Context context) {
    mContext = context;
    mWindow = new PopupWindow(context);

    mWindow.setTouchInterceptor(new OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                mWindow.dismiss();
                return true;
            }
            return false;
        }
    });

    mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
}