Java 类android.view.View.OnFocusChangeListener 实例源码
项目:FMTech
文件:FormEditText.java
@TargetApi(16)
public void onFocusChanged(boolean paramBoolean, int paramInt, Rect paramRect)
{
super.onFocusChanged(paramBoolean, paramInt, paramRect);
triggerAutocompleteSuggestionsIfPossible();
if ((!paramBoolean) && (getError() == null) && (this.mOutOfFocusFieldValidatable != null)) {
this.mOutOfFocusFieldValidatable.validate();
}
if ((paramBoolean) && (getError() != null)) {
announceError();
}
if (this.mFocusChangeListenerList != null)
{
Iterator localIterator = this.mFocusChangeListenerList.iterator();
while (localIterator.hasNext()) {
((View.OnFocusChangeListener)localIterator.next()).onFocusChange(this, paramBoolean);
}
}
}
项目:GrooveBerry
文件:PlayActivity.java
public void createViewItems() {
this.play = (ImageButton) findViewById(R.id.playButton);
this.next = (ImageButton) findViewById(R.id.nextButton);
this.previous = (ImageButton) findViewById(R.id.previousButton);
this.random = (ImageButton) findViewById(R.id.btnShuffle);
this.loop = (ImageButton) findViewById(R.id.btnRepeat);
this.musicName = (TextView) findViewById(R.id.textView2);
this.notConnectedWarning = (TextView) findViewById(R.id.textView4);
this.warningLogo = (ImageView) findViewById(R.id.imageView2);
this.mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
this.mDrawerList = (ListView) findViewById(R.id.list_slidermenu);
this.upload = (ImageButton) findViewById(R.id.upload_button);
this.download = (ImageButton) findViewById(R.id.download_button);
this.inputSearch = (EditText) findViewById(R.id.inputSearch);
OnFocusChangeListener ofcListener = new MyFocusChangeListener();
this.inputSearch.setOnFocusChangeListener(ofcListener);
}
项目:EasyAccess
文件:ContactUpdate.java
/**
* Attaches onTouchListener and onFocusListener to the EditText.
*
* @param editText
* The editText with which the onTouchListener and
* onFocusChangeListener are to be associated.
*/
void attachOnTouchAndFocusListener(final EditText editText) {
final String text = editText.getText().toString().trim();
editText.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean hasFocus) {
if (hasFocus && !(text.equals(""))) {
// check if keyboard is connected but accessibility services
// are disabled
if (!Utils.isAccessibilityEnabled(getApplicationContext())
&& getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS) {
if (text.equals("")) {
// empty EditText
TTS.speak(editText.getHint().toString());
} else {
if (text.matches("-?\\d+(\\.\\d+)?")) {
TTS.readNumber(text);
} else {
TTS.speak(text);
}
}
}
}
}
});
}
项目:EasyAccess
文件:AboutActivity.java
/**
* Attach onFocusChangeListener to the TextView passed as parameter to the
* method. If a keyboard is connected to the device, a TTS feedback would be
* given to the user informing him/her about the text on the TextView that
* received focus.
*
* @param textView
* is an instance of TextView.
*/
void attachListenerToTextView(final TextView textView) {
textView.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean hasFocus) {
if (hasFocus) {
// check if keyboard is connected but accessibility services
// are disabled
if (!Utils.isAccessibilityEnabled(getApplicationContext())
&& getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS)
giveFeedback(textView.getText().toString());
}
}
});
}
项目:LaunchEnr
文件:ViewGroupFocusHelper.java
/**
* Sets the alpha of this FocusIndicatorHelper to 0 when a view with this listener
* receives focus.
*/
public View.OnFocusChangeListener getHideIndicatorOnFocusListener() {
return new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
endCurrentAnimation();
setCurrentView(null);
setAlpha(0);
invalidateDirty();
}
}
};
}
项目:FlickLauncher
文件:ViewGroupFocusHelper.java
/**
* Sets the alpha of this FocusIndicatorHelper to 0 when a view with this listener
* receives focus.
*/
public View.OnFocusChangeListener getHideIndicatorOnFocusListener() {
return new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
endCurrentAnimation();
setCurrentView(null);
setAlpha(0);
invalidateDirty();
}
}
};
}
项目:SimpleUILauncher
文件:ViewGroupFocusHelper.java
/**
* Sets the alpha of this FocusIndicatorHelper to 0 when a view with this listener
* receives focus.
*/
public View.OnFocusChangeListener getHideIndicatorOnFocusListener() {
return new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
endCurrentAnimation();
setCurrentView(null);
setAlpha(0);
invalidateDirty();
}
}
};
}
项目:smile-mvp
文件:DialogBase.java
/**
* 获取焦点改变事件监听,设置EditText文本默认全选
* @return 焦点改变事件监听
*/
protected OnFocusChangeListener getOnFocusChangeListener() {
return new OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus && v instanceof EditText) {
((EditText) v).setSelection(0, ((EditText) v).getText().length());
}
}
};
}
项目:C.
文件:AtyDetail.java
private void showButtonDone(){
View view=vf.getCurrentView();
EditText etContent=(EditText) view.findViewById(R.id.aty_detail_content);
etContent.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean arg1) {
if(arg1){
biDone.setVisibility(View.VISIBLE);
}else{
biDone.setVisibility(View.GONE);
}
}
});
}
项目:rdt
文件:MainActivity.java
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.entry_form);
final OnFocusChangeListener decimalNumberFormatter = new DecimalNumberFormattingOnFocusChangeListener();
valueExtreme = getTextViewAndAddResettableWatcher(R.id.value_extreme);
valueExtreme.setOnFocusChangeListener(decimalNumberFormatter);
unitExtreme = getTextViewAndAddResettableWatcher(R.id.unit_extreme);
valueMeansB = getTextViewAndAddResettableWatcher(R.id.value_means_b);
valueMeansB.setOnFocusChangeListener(decimalNumberFormatter);
unitMeansB = getTextViewAndAddResettableWatcher(R.id.unit_means_b);
valueMeansC = getTextViewAndAddResettableWatcher(R.id.value_means_c);
valueMeansC.setOnFocusChangeListener(decimalNumberFormatter);
unitMeansC = getTextViewById(R.id.unit_means_c);
valueResult = getTextViewById(R.id.value_result);
unitResult = getTextViewById(R.id.unit_result);
buttonCalculate = (Button) findViewById(R.id.entry_form_button_calculate);
buttonCalculate.setOnClickListener(createCalculateButtonOnClickListener());
buttonReset = (Button) findViewById(R.id.entry_form_button_reset);
buttonReset.setOnClickListener(createResetButtonOnClickListener());
requiredViewsForCalculation.add(valueExtreme);
requiredViewsForCalculation.add(valueMeansB);
requiredViewsForCalculation.add(valueMeansC);
}
项目:air-ane-fullscreen
文件:FullScreenContext.java
public View.OnFocusChangeListener getOnFocusChangeListener()
{
if (_onFocusChangeListener == null)
{
_onFocusChangeListener = getDecorView().getOnFocusChangeListener();
}
return _onFocusChangeListener;
}
项目:EasyAccess
文件:SaveContact.java
/**
* Attaches onTouchListener and onFocusListener to the EditText passed as a
* parameter.
*
* @param editText
* The EditText with which the onTouchListener and
* onFocusListener are to be associated.
*/
void attachOnTouchAndFocusListener(final EditText editText) {
final String text = editText.getText().toString().trim();
editText.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean hasFocus) {
if (hasFocus && !(text.equals(""))) {
// check if keyboard is connected but accessibility services
// are disabled
if (!Utils.isAccessibilityEnabled(getApplicationContext())
&& getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS) {
if (text.equals("")) {
// empty EditText
TTS.speak(editText.getHint().toString());
} else {
if (text.matches("-?\\d+(\\.\\d+)?")) {
TTS.readNumber(text);
} else {
TTS.speak(text);
}
}
}
}
}
});
}
项目:EasyAccess
文件:EasyAccessActivity.java
/**
* Attaches onFocusChangeListener to the button passed as a parameter. When the button receives focus, giveFeedback method is called, that reads aloud the
* string passed to it as a parameter.
*
* @param button is an instance of Button.
*/
protected void attachListener(Button button) {
final String text = button.getText().toString();
button.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean hasFocus) {
if (hasFocus) {
giveFeedback(text);
}
}
});
}
项目:EasyAccess
文件:EasyAccessActivity.java
/**
* Attachs onFocusChangeListener to the spinner passed as a parameter. When the spinner receives focus, giveFeedback method is called, that reads aloud the
* string passed to it as a parameter.
*
* @param spinner is an instance of Spinner.
*/
protected void attachListenerToSpinner(Spinner spinner) {
final String text = spinner.getContentDescription().toString();
spinner.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean hasFocus) {
if (hasFocus) {
giveFeedback(text);
}
}
});
}
项目:EasyAccess
文件:StatusApp.java
/**
* Attaches onFocusChange listener to the TextView passed as a parameter to
* the method, to track the change in focus of the TextView. If the TextView
* receives focus, pass the content description of the TextView to
* giveFeedback().
*
* @param textView
* This is an instance of TextView.
*/
public void attachListener(final TextView textView) {
textView.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean hasFocus) {
if (hasFocus) {
giveFeedback(textView.getContentDescription().toString());
}
}
});
}
项目:EasyAccess
文件:TextMessagesViewerApp.java
/**
* Attaches onFocusListener to the TextView passed as a parameter. The text
* specified in the TextView is sent to giveFeedback method.
*
* @param textView
* The TextView with which onFocusChange listener is to be
* associated.
**/
void attachListenerToTextView(TextView textView) {
final String text = textView.getText().toString();
textView.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean hasFocus) {
if (hasFocus) {
giveFeedback(text);
}
}
});
}
项目:EasyAccess
文件:SettingsVolume.java
/**
* Attaches onFocusChange listener to the TextView passed as a parameter to
* the method, to track the change in focus of the TextView. If the TextView
* receives focus, pass the content description of the TextView to
* giveFeedback().
*
* @param textView
* This is an instance of TextView.
*/
void attachListenerToTextView(TextView textView) {
textView.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean hasFocus) {
if (hasFocus) {
giveFeedback(((TextView) view).getText().toString());
}
}
});
}
项目:EasyAccess
文件:SettingsColor.java
/**
* Attaches onFocusChange listener to the TextView passed as parameter to
* the method. If a keyboard is connected to the device, a TTS feedback
* would be given to the user informing him/her about the text on the
* TextView that received focus.
*
* @param textView
* This is an instance of TextView.
*/
void attachListenerToTextView(TextView textView) {
textView.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean hasFocus) {
if (hasFocus) {
giveFeedback(((TextView) view).getText().toString());
}
}
});
}
项目:EasyAccess
文件:Utils.java
/**
* Attaches onFocusChangeListener to the button passed as a parameter. When the button receives focus, giveFeedback method is called, that reads aloud the
* string passed to it as a parameter.
*
* @param context The context of the application that invoked the method.
* @param button The button with which the onFocusChange listener is to be associated.
*/
public static void attachListener(final Context context, Button button) {
final String text = button.getText().toString();
button.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean hasFocus) {
if (hasFocus) {
giveFeedback(context, text);
}
}
});
}
项目:Matrix-Mate
文件:MatrixMateActivity.java
private OnFocusChangeListener editTextOnFocus(final int row,
final int column) {
return new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
// TODO Auto-generated method stub
if (complexInput) {
if (hasFocus) {
if (complexStrings.get((row - 1) * columns + column) != null
&& !complexStrings.get(
(row - 1) * columns + column).matches(
"")) {
((EditText) v).setText(complexStrings.get((row - 1)
* columns + column));
}
} else {
try {
Evaluator eval = new Evaluator();
String string = ((EditText) v).getText().toString();
if (!string.trim().matches("")) {
complexStrings.put(
((row - 1) * columns + column), string);
((EditText) v).setText(eval.evaluate(string));
}
} catch (EvaluationException e) {
Toast.makeText(v.getContext(),
e.getLocalizedMessage().toString(),
Toast.LENGTH_SHORT).show();
}
}
}
}
};
}
项目:Diandi1.20
文件:DialogBase.java
/**
* 获取焦点改变事件监听,设置EditText文本默认全选
*
* @return 焦点改变事件监听
*/
protected OnFocusChangeListener GetOnFocusChangeListener() {
return new OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus && v instanceof EditText) {
((EditText) v).setSelection(0, ((EditText) v).getText().length());
}
}
};
}
项目:tomdroid
文件:EditNote.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Preferences.init(this, Tomdroid.CLEAR_PREFERENCES);
setContentView(R.layout.note_edit);
content = (EditText) findViewById(R.id.content);
title = (EditText) findViewById(R.id.title);
formatBar = (SlidingDrawer) findViewById(R.id.formatBar);
content.setOnFocusChangeListener(new OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if(hasFocus && !xmlOn) {
formatBar.setVisibility(View.VISIBLE);
}
else {
formatBar.setVisibility(View.GONE);
}
}
});
neverSaved = getIntent().getBooleanExtra(Tomdroid.IS_NEW_NOTE_EXTRA, false);
uri = getIntent().getData();
}
项目:goeuro-demo
文件:SearchActivity.java
private void initViews() {
buttonStartSearch.setEnabled(false);
autocompleteEditFieldDeparture = (AutoCompleteEditField) getFragmentManager()
.findFragmentById(R.id.autocompleteEditFieldDeparture);
autocompleteEditFieldDestination = (AutoCompleteEditField) getFragmentManager()
.findFragmentById(R.id.autocompleteEditFieldDestination);
autocompleteEditFieldDeparture
.setHint(getString(R.string.search_hint_departure));
autocompleteEditFieldDestination
.setHint(getString(R.string.search_hint_destination));
LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
autocompleteEditFieldDeparture
.setTextChangeListener(new GoEuroSuggestion(locationManager));
autocompleteEditFieldDestination
.setTextChangeListener(new GoEuroSuggestion(locationManager));
OnFinishedListener checkButtonAvialble = new OnFinishedListener() {
public void finished() {
checkButtonAvailabe();
}
};
autocompleteEditFieldDeparture
.setOnFinishedListener(checkButtonAvialble);
autocompleteEditFieldDestination
.setOnFinishedListener(checkButtonAvialble);
editTextDate.setOnFocusChangeListener(new OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
checkButtonAvailabe();
}
});
}
项目:cultureshock
文件:JoinActivity.java
public void setUi()
{
m_oImageUpload = (LinearLayout)findViewById(R.id.img_upload);
m_oImage = (ImageView)findViewById(R.id.join_image);
m_oUserName = (EditText)findViewById(R.id.join_username);
m_oEmail = (EditText)findViewById(R.id.join_email);
m_oPassword = (EditText)findViewById(R.id.join_password);
m_oPasswordConfirm = (EditText)findViewById(R.id.join_password_confirm);
m_oBtnConfirm = (LinearLayout)findViewById(R.id.btn_confirm);
m_oImgDoubleCheck = (ImageView)findViewById(R.id.double_check_img);
m_oEmail.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
// TODO Auto-generated method stub
if(hasFocus==false)
{
if((m_oEmail.getText().toString().equals("")))
{
//아이디 입력해주세요
Toast.makeText(JoinActivity.this, "이메일을 입력해주세요", Toast.LENGTH_SHORT).show();
}
else
{
reqeustDoubleId();
}
}
}
});
m_oImageUpload.setOnClickListener(this);
m_oBtnConfirm.setOnClickListener(this);
}
项目:Multiplanner
文件:SearchFragment.java
private void setupfocusCHangeListener(MultiAutoCompleteTextView view) {
view.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
// TODO Auto-generated method stub
if (hasFocus)
ScrollToView(v);
}
});
}
项目:GalbijjimSearcher
文件:MainActivity.java
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getSupportMenuInflater().inflate(R.menu.main, menu);
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
final MenuItem searchMenuItem = menu.findItem(R.id.menu_main_search);
final SearchView searchView = (SearchView) searchMenuItem.getActionView();
if (null != searchView ) {
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
searchView.setIconifiedByDefault(false);
}
SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() {
public boolean onQueryTextChange(String newText) {
return true;
}
public boolean onQueryTextSubmit(String query) {
query = query.trim();
if (query.length() > 0) {
textToSearch = query;
((GridFragment)getSupportFragmentManager().findFragmentById(R.id.grid_fragment)).Search();
mDrawer.closeMenu();
searchMenuItem.collapseActionView();
searchView.setQuery("", false);
}
return true;
}
};
searchView.setOnQueryTextListener(queryTextListener);
searchView.setOnQueryTextFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View arg0, boolean queryTextFocused) {
if(!queryTextFocused) {
searchMenuItem.collapseActionView();
searchView.setQuery("", false);
}
}
});
return true;
}
项目:if26_projet
文件:FormEmailFragment.java
private void initListeners() {
this.email_input.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(!hasFocus){
isInputValide();
}
}
});
}
项目:if26_projet
文件:FormSimpleInputFragment.java
private void initListeners() {
this.simple_input.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(!hasFocus){
isInputValide();
}
}
});
}
项目:if26_projet
文件:FormPasswordFragment.java
private void initListeners() {
// TODO Auto-generated method stub
this.password_input.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
// TODO Auto-generated method stub
if(!hasFocus){
isInputValide();
}
}
});
}
项目:LaunchEnr
文件:AllAppsGridAdapter.java
void setIconFocusListener(OnFocusChangeListener focusListener) {
mIconFocusListener = focusListener;
}
项目:LaunchEnr
文件:FocusedItemDecorator.java
public OnFocusChangeListener getFocusListener() {
return mHelper;
}
项目:AndroidViewHelper
文件:ViewWrapper.java
/**
* @see View#setOnFocusChangeListener(OnFocusChangeListener)
*/
public W setOnFocusChangeListener(OnFocusChangeListener l) {
mView.setOnFocusChangeListener(l);
return (W)this;
}
项目:SimpleDialogFragments
文件:ClearableEditText.java
@Override
public void setOnFocusChangeListener(OnFocusChangeListener f) {
this.f = f;
}
项目:boohee_v5.6
文件:SearchView.java
public void setOnQueryTextFocusChangeListener(OnFocusChangeListener listener) {
this.mOnQueryTextFocusChangeListener = listener;
}
项目:FlickLauncher
文件:AllAppsGridAdapter.java
public void setIconFocusListener(OnFocusChangeListener focusListener) {
mIconFocusListener = focusListener;
}
项目:FlickLauncher
文件:FocusedItemDecorator.java
public OnFocusChangeListener getFocusListener() {
return mHelper;
}
项目:SimpleUILauncher
文件:AllAppsGridAdapter.java
public void setIconFocusListener(OnFocusChangeListener focusListener) {
mIconFocusListener = focusListener;
}
项目:SimpleUILauncher
文件:FocusedItemDecorator.java
public OnFocusChangeListener getFocusListener() {
return mHelper;
}
项目:solved-hacking-problem
文件:SearchView.java
public void setOnQueryTextFocusChangeListener(OnFocusChangeListener onFocusChangeListener) {
this.f1218s = onFocusChangeListener;
}
项目:solved-hacking-problem
文件:SearchView.java
public void setOnQueryTextFocusChangeListener(OnFocusChangeListener onFocusChangeListener) {
this.f1218s = onFocusChangeListener;
}