当前位置: 首页>>代码示例>>Java>>正文


Java View.OnFocusChangeListener方法代码示例

本文整理汇总了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)));

            }
        }
    };
}
 
开发者ID:MohamedNagyMostafa,项目名称:IM_Here,代码行数:20,代码来源:Animation.java

示例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();
            }
        }
    };
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:18,代码来源:ViewGroupFocusHelper.java

示例3: onFocusChange

import android.view.View; //导入方法依赖的package包/类
@Override
public void onFocusChange(View view, boolean b) {

    for(View.OnFocusChangeListener listener:registeredListeners) {
        listener.onFocusChange(view, b);
    }
}
 
开发者ID:HITGIF,项目名称:TextFieldBoxes,代码行数:8,代码来源:CompositeListener.java

示例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);
}
 
开发者ID:dufangyu1990,项目名称:JKApp,代码行数:9,代码来源:EventHelper.java

示例5: setOnFocusListener

import android.view.View; //导入方法依赖的package包/类
public void setOnFocusListener(int viewId, View.OnFocusChangeListener listener) {
    View view = findView(viewId);
    view.setOnFocusChangeListener(listener);
}
 
开发者ID:InnoFang,项目名称:Android-Code-Demos,代码行数:5,代码来源:CustomPopupWindow.java

示例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);
                }
            });
        }
    });
}
 
开发者ID:tresorit,项目名称:ZeroKit-Android-Sample,代码行数:63,代码来源:RegistrationViewModel.java

示例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("");
        }
    };
}
 
开发者ID:tresorit,项目名称:ZeroKit-Android-Sample,代码行数:42,代码来源:LoginViewModel.java

示例8: setOnFocusChangeListener

import android.view.View; //导入方法依赖的package包/类
public SuperRecyclerHolder setOnFocusChangeListener(
    @NonNull View.OnFocusChangeListener listener) {
    getItemView().setOnFocusChangeListener(listener);
    return this;
}
 
开发者ID:qinxiaoguai,项目名称:SuperRecyclerViewAdapter,代码行数:6,代码来源:SuperRecyclerHolder.java

示例9: withOnFocusChangeListener

import android.view.View; //导入方法依赖的package包/类
public PhoneMaskManager withOnFocusChangeListener(View.OnFocusChangeListener onFocusChangeListener) {
    this.onFocusChangeListener = onFocusChangeListener;
    return this;
}
 
开发者ID:vacxe,项目名称:PhoneMask,代码行数:5,代码来源:PhoneMaskManager.java

示例10: registerListener

import android.view.View; //导入方法依赖的package包/类
void registerListener (View.OnFocusChangeListener listener) {
    registeredListeners.add(listener);
}
 
开发者ID:HITGIF,项目名称:TextFieldBoxes,代码行数:4,代码来源:CompositeListener.java

示例11: getOnFocusChangeListener

import android.view.View; //导入方法依赖的package包/类
/**
 * Delegiert von android.widget.Button
 *
 * @return siehe {@link Button}
 */
public View.OnFocusChangeListener getOnFocusChangeListener() {
    return b.getOnFocusChangeListener();
}
 
开发者ID:LCA311,项目名称:leoapp-sources,代码行数:9,代码来源:InfoButton.java

示例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);
}
 
开发者ID:LCA311,项目名称:leoapp-sources,代码行数:9,代码来源:InfoButton.java


注:本文中的android.view.View.OnFocusChangeListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。