本文整理汇总了Java中android.view.View.OnFocusChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java View.OnFocusChangeListener方法的具体用法?Java View.OnFocusChangeListener怎么用?Java View.OnFocusChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.OnFocusChangeListener方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: editTextFocusChange
import android.view.View; //导入方法依赖的package包/类
private static View.OnFocusChangeListener editTextFocusChange(final EditText editText, final Context context){
return new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean hasFocus) {
if(hasFocus || !editText.getText().toString().equals("")){
editText.setBackgroundTintList(
ColorStateList.valueOf(
context.getResources()
.getColor(FOCUS_COLOR)));
}else{
editText.setBackgroundTintList(
ColorStateList.valueOf(
context.getResources()
.getColor(LEAVE_COLOR)));
}
}
};
}
示例2: getHideIndicatorOnFocusListener
import android.view.View; //导入方法依赖的package包/类
/**
* 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();
}
}
};
}
示例3: onFocusChange
import android.view.View; //导入方法依赖的package包/类
@Override
public void onFocusChange(View view, boolean b) {
for(View.OnFocusChangeListener listener:registeredListeners) {
listener.onFocusChange(view, b);
}
}
示例4: focus
import android.view.View; //导入方法依赖的package包/类
public static void focus(IPresent li,View...views)
{
if(!(li instanceof View.OnFocusChangeListener))
{
return;
}
focus((View.OnFocusChangeListener)li,views);
}
示例5: setOnFocusListener
import android.view.View; //导入方法依赖的package包/类
public void setOnFocusListener(int viewId, View.OnFocusChangeListener listener) {
View view = findView(viewId);
view.setOnFocusChangeListener(listener);
}
示例6: RegistrationViewModel
import android.view.View; //导入方法依赖的package包/类
@Inject
public RegistrationViewModel(final Zerokit zerokit, AdminApi adminApi, final EventBus eventBus, SharedPreferences sharedPreferences, final Resources resources) {
this.zerokit = zerokit;
this.adminApi = adminApi;
this.eventBus = eventBus;
this.sharedPreferences = sharedPreferences;
inProgress = new ObservableField<>(false);
userName = new ObservableField<>("");
passwordError = new ObservableField<>("");
passwordConfirmError = new ObservableField<>("");
userNameError = new ObservableField<>("");
passwordStrength = new ObservableInt();
seekbarColor = new ObservableField<>(resources.getDrawable(R.drawable.progress));
colorRes = new int[]{R.color.red, R.color.deep_orange, R.color.orange, R.color.light_green, R.color.green};
clickListenerRegistration = new View.OnClickListener() {
@Override
public void onClick(View view) {
attemptRegistration();
}
};
errorResponseHandlerAdmin = new Action<ResponseAdminApiError>() {
@Override
public void call(ResponseAdminApiError responseAdminApiError) {
inProgress.set(false);
eventBus.post(new ShowMessageMessage(responseAdminApiError.getMessage()));
}
};
errorResponseHandlerSdk = new Action<ResponseZerokitError>() {
@Override
public void call(ResponseZerokitError errorResponse) {
inProgress.set(false);
eventBus.post(new ShowMessageMessage(errorResponse.getDescription()));
}
};
focusChangeListener = new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
passwordError.set("");
userNameError.set("");
passwordConfirmError.set("");
}
};
passwordExporter = new PasswordEditText.PasswordExporter();
passwordExporterConfirm = new PasswordEditText.PasswordExporter();
passwordExporter.setOnChangeListener(new PasswordEditText.OnChangeListener() {
@Override
public void onChanged() {
zerokit.getPasswordStrength(passwordExporter).enqueue(new Action<ResponseZerokitPasswordStrength>() {
@Override
public void call(ResponseZerokitPasswordStrength responseZerokitPasswordStrength) {
int score = responseZerokitPasswordStrength.getScore();
passwordStrength.set((score + 1) * 20);
((LayerDrawable) seekbarColor.get()).findDrawableByLayerId(android.R.id.progress).setColorFilter(resources.getColor(colorRes[score]), PorterDuff.Mode.SRC_IN);
}
});
}
});
}
示例7: LoginViewModel
import android.view.View; //导入方法依赖的package包/类
@Inject
public LoginViewModel(Zerokit zerokit, AdminApi adminApi, final EventBus eventBus) {
this.zerokit = zerokit;
this.adminApi = adminApi;
this.eventBus = eventBus;
this.passwordExporter = new PasswordEditText.PasswordExporter();
this.clickListenerLogin = new View.OnClickListener() {
@Override
public void onClick(View view) {
attemptLogin();
}
};
userName = new ObservableField<>("");
passwordError = new ObservableField<>("");
usernameError = new ObservableField<>("");
inProgress = new ObservableField<>(false);
errorResponseHandlerSdk = new Action<ResponseZerokitError>() {
@Override
public void call(ResponseZerokitError errorResponse) {
inProgress.set(false);
eventBus.post(new ShowMessageMessage(errorResponse.toString()));
}
};
errorResponseHandlerAdminapi = new Action<ResponseAdminApiError>() {
@Override
public void call(ResponseAdminApiError errorResponse) {
inProgress.set(false);
eventBus.post(new ShowMessageMessage(errorResponse.toString()));
}
};
focusChangeListener = new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
passwordError.set("");
usernameError.set("");
}
};
}
示例8: setOnFocusChangeListener
import android.view.View; //导入方法依赖的package包/类
public SuperRecyclerHolder setOnFocusChangeListener(
@NonNull View.OnFocusChangeListener listener) {
getItemView().setOnFocusChangeListener(listener);
return this;
}
示例9: withOnFocusChangeListener
import android.view.View; //导入方法依赖的package包/类
public PhoneMaskManager withOnFocusChangeListener(View.OnFocusChangeListener onFocusChangeListener) {
this.onFocusChangeListener = onFocusChangeListener;
return this;
}
示例10: registerListener
import android.view.View; //导入方法依赖的package包/类
void registerListener (View.OnFocusChangeListener listener) {
registeredListeners.add(listener);
}
示例11: getOnFocusChangeListener
import android.view.View; //导入方法依赖的package包/类
/**
* Delegiert von android.widget.Button
*
* @return siehe {@link Button}
*/
public View.OnFocusChangeListener getOnFocusChangeListener() {
return b.getOnFocusChangeListener();
}
示例12: setOnFocusChangeListener
import android.view.View; //导入方法依赖的package包/类
/**
* Delegiert von android.widget.Button
*
* @param l siehe {@link Button}
*/
public void setOnFocusChangeListener(View.OnFocusChangeListener l) {
b.setOnFocusChangeListener(l);
}