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


Java AppCompatCheckBox.setOnCheckedChangeListener方法代码示例

本文整理汇总了Java中android.support.v7.widget.AppCompatCheckBox.setOnCheckedChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java AppCompatCheckBox.setOnCheckedChangeListener方法的具体用法?Java AppCompatCheckBox.setOnCheckedChangeListener怎么用?Java AppCompatCheckBox.setOnCheckedChangeListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v7.widget.AppCompatCheckBox的用法示例。


在下文中一共展示了AppCompatCheckBox.setOnCheckedChangeListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertCommon

import android.support.v7.widget.AppCompatCheckBox; //导入方法依赖的package包/类
@Override
public void convertCommon(ViewHolder viewHolder, final List<AppInfo> appInfo, final int position) {
    super.convertCommon(viewHolder, appInfo, position);
    final AppInfo info = appInfo.get(position);
    viewHolder.setText(R.id.tv_app_package_name, info.getAppPackageName());
    ((TextView) viewHolder.getView(R.id.tv_app_name)).setTextColor(info.isEnable() == 1
            ? mResources.getColor(R.color.textPrimary)
            : mResources.getColor(R.color.translucentBg));
    ((ImageView) viewHolder.getView(R.id.iv_app_icon)).getDrawable().setColorFilter(info.isEnable() == 1
            ? mColorFilterNormal : mColorFilterGrey);
    ((TextView) viewHolder.getView(R.id.tv_app_package_name)).setTextColor(info.isEnable() == 1
            ? mResources.getColor(R.color.textSecondary)
            : mResources.getColor(R.color.translucentBg));
    AppCompatCheckBox cb = viewHolder.getView(R.id.cb_select_apps);
    cb.setOnCheckedChangeListener(null); // CheckBox在执行setChecked时会触发setOnCheckedChangeListener
    cb.setChecked(mDisablePackages.contains(info.getAppPackageName()));
    cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (mCheckedChangeListener != null) {
                mCheckedChangeListener.onCheckedChanged(info, position, isChecked);
            }
        }
    });
}
 
开发者ID:XYScience,项目名称:StopApp,代码行数:26,代码来源:AppListAdapter.java

示例2: ifHuaweiAlert

import android.support.v7.widget.AppCompatCheckBox; //导入方法依赖的package包/类
private void ifHuaweiAlert() {
    final SharedPreferences settings = getSharedPreferences("ProtectedApps", MODE_PRIVATE);
    final String saveIfSkip = "skipProtectedAppsMessage";
    boolean skipMessage = settings.getBoolean(saveIfSkip, false);
    if (!skipMessage) {
        final SharedPreferences.Editor editor = settings.edit();
        Intent intent = new Intent();
        intent.setClassName("com.huawei.systemmanager", "com.huawei.systemmanager.optimize.process.ProtectActivity");
        if (isCallable(intent)) {
            final AppCompatCheckBox dontShowAgain = new AppCompatCheckBox(this);
            dontShowAgain.setText(R.string.Do_not_show_again);
            dontShowAgain.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    editor.putBoolean(saveIfSkip, isChecked);
                    editor.apply();
                }
            });

            new AlertDialog.Builder(this)
                    .setTitle("Huawei Protected Apps")
                    .setMessage(String.format("%s requires to be enabled in 'Protected Apps' to send notifications.%n", getString(R.string.app_name)))
                    .setView(dontShowAgain)
                    .setPositiveButton("Protected Apps", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            huaweiProtectedApps();
                        }
                    })
                    .setNegativeButton("Cancel", null)
                    .show();
        } else {
            editor.putBoolean(saveIfSkip, true);
            editor.apply();
        }
    }
}
 
开发者ID:Cesarsk,项目名称:Say_it,代码行数:37,代码来源:MainActivity.java

示例3: UserHolder

import android.support.v7.widget.AppCompatCheckBox; //导入方法依赖的package包/类
public UserHolder(View itemView) {
    super(itemView);
    photo = (CircleImageView) itemView.findViewById(R.id.new_chat_member_image);
    name = (TextView) itemView.findViewById(R.id.new_chat_member_name);
    userCheckBox = (AppCompatCheckBox) itemView.findViewById(R.id.new_chat_member_checkbox);
    userCheckBox.setOnCheckedChangeListener(
            (buttonView, isChecked) -> {
                long userId = users.get(getAdapterPosition()).getUserId();
                if (isChecked) {
                    checkedUsers.add(userId);
                    name.setTextColor(context.getResources().getColor(R.color.new_chat_member_name_checked));
                    listener.onCheckBoxClickPush(userId);
                } else {
                    checkedUsers.remove(userId);
                    name.setTextColor(context.getResources().getColor(R.color.new_chat_member_name));
                    listener.onCheckBoxClickPull(userId);
                }
            });
}
 
开发者ID:ukevgen,项目名称:BizareChat,代码行数:20,代码来源:EditChatRecyclerViewAdapter.java

示例4: UserHolder

import android.support.v7.widget.AppCompatCheckBox; //导入方法依赖的package包/类
public UserHolder(View itemView) {
    super(itemView);
    photo = (CircleImageView) itemView.findViewById(R.id.new_chat_member_image);
    name = (TextView) itemView.findViewById(R.id.new_chat_member_name);
    userCheckBox = (AppCompatCheckBox) itemView.findViewById(R.id.new_chat_member_checkbox);
    userCheckBox.setOnCheckedChangeListener(
            (buttonView, isChecked) -> {
                if (isChecked) {
                    checkedUsers.add(users.get(getAdapterPosition()).getUserId());
                    name.setTextColor(context.getResources().getColor(R.color.new_chat_member_name_checked));
                } else {
                    checkedUsers.remove(users.get(getAdapterPosition()).getUserId());
                    name.setTextColor(context.getResources().getColor(R.color.new_chat_member_name));
                }
                listener.onCheckBoxClick();
            });
}
 
开发者ID:ukevgen,项目名称:BizareChat,代码行数:18,代码来源:NewChatUsersRecyclerAdapter.java

示例5: setupCheckbox

import android.support.v7.widget.AppCompatCheckBox; //导入方法依赖的package包/类
/**
 * Setups checkbox in menu.
 * @param menu menu
 */
private void setupCheckbox(Menu menu)
{
	AppCompatCheckBox checkBox = (AppCompatCheckBox) menu.findItem(R.id.equalizer_lock).getActionView();
	ColorStateList colorStateList = new ColorStateList(new int[][]{
			new int[]{-android.R.attr.state_enabled}, // disabled
			new int[]{android.R.attr.state_enabled}, // enabled
	},
			new int[]{
					Color.WHITE, // disabled
					Color.WHITE // enabled
			});
	checkBox.setSupportButtonTintList(colorStateList);
	checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
		@Override
		public void onCheckedChanged(CompoundButton compoundButton, boolean b)
		{
			lockedSliders = b;
		}
	});
	checkBox.setText(getString(R.string.lock_sliders));
	checkBox.setChecked(true);
	checkBox.setPadding(0,0,Math.round(getResources().getDimension(R.dimen.activity_horizontal_margin)),0);
}
 
开发者ID:JiriSko,项目名称:amixer-webui-android,代码行数:28,代码来源:EqualizerActivity.java

示例6: initUI

import android.support.v7.widget.AppCompatCheckBox; //导入方法依赖的package包/类
@Override
protected void initUI() {
    LinearLayout linearLayout=new LinearLayout(getContext());
    linearLayout.setOrientation(LinearLayout.HORIZONTAL);
    checkBox=new AppCompatCheckBox(getContext());
    checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            TodoLayout.this.isChecked=isChecked;
        }
    });
    editText=new BaseRichEditText(getContext());
    editText.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT,1.0f));
    linearLayout.addView(checkBox);
    linearLayout.addView(editText);
    this.addView(linearLayout);
}
 
开发者ID:tianyuan168326,项目名称:nono-android,代码行数:18,代码来源:TodoLayout.java

示例7: addMultipleChoice

import android.support.v7.widget.AppCompatCheckBox; //导入方法依赖的package包/类
public void addMultipleChoice(String text, boolean checked, final OnCheckListener listener) {
    ColorStateList colorStateList = new ColorStateList(
            new int[][]{
                    new int[]{-android.R.attr.state_enabled}, //disabled
                    new int[]{android.R.attr.state_enabled}, //enabled
                    new int[]{android.R.attr.state_checked}
            },
            new int[]{
                    R.color.checkbox_disabled_color, //disabled
                    R.color.checkbox_enabled_color, //enabled
                    R.color.checkbox_checked_color
            }
    );

    AppCompatCheckBox box = new AppCompatCheckBox(getContext());
    box.setChecked(checked);
    box.setSupportButtonTintList(colorStateList);
    box.setText(localize(text));
    box.setTextColor(getResources().getColor(R.color.text_dark));
    box.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            listener.onCheck(isChecked);
        }
    });
    mCheckBoxes.addView(box);
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-android,代码行数:28,代码来源:ChoiceView.java

示例8: getView

import android.support.v7.widget.AppCompatCheckBox; //导入方法依赖的package包/类
@Override
public View getView(int position, View view, ViewGroup viewGroup) {
    if (view == null) {
        view = View.inflate(mContext, R.layout.tooltips_popup, null);
    }

    TextView content = view.findViewById( R.id.content);
    TextView desc = view.findViewById( R.id.desc);
    AppCompatCheckBox checkBox = view.findViewById( R.id.checkbox);
    TextView button = view.findViewById( R.id.button);

    content.setText(mBuilder.mContent);
    button.setText(mBuilder.mButton);

    if (mBuilder.mDesc != null) {
        desc.setVisibility(View.VISIBLE);
        desc.setText(mBuilder.mDesc);

        if (mBuilder.mDescIcon != 0) {
            int color = ColorHelper.getAttributeColor(mContext, android.R.attr.textColorPrimary);
            Drawable drawable = DrawableHelper.getTintedDrawable(mContext, mBuilder.mDescIcon, color);
            desc.setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null);
        }
    }


    checkBox.setVisibility(mBuilder.mIsDontShowAgainVisible ? View.VISIBLE : View.GONE);
    checkBox.setOnCheckedChangeListener((compoundButton, b) -> mCheckboxState = b);

    button.setOnClickListener(v -> {
        if (mBuilder.mCallback != null) {
            mBuilder.mCallback.onButtonClick(mTooltip);
            return;
        }

        mTooltip.dismiss();
    });
    return view;
}
 
开发者ID:danimahardhika,项目名称:wallpaperboard,代码行数:40,代码来源:Tooltip.java

示例9: ifHuaweiAlert

import android.support.v7.widget.AppCompatCheckBox; //导入方法依赖的package包/类
private void ifHuaweiAlert() {
    if (Build.MANUFACTURER.equalsIgnoreCase("huawei")) {
        final SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(App.getAppContext());

        if (!defaultSharedPreferences.getBoolean("protected_apps", false)) {
            final SharedPreferences.Editor editor = defaultSharedPreferences.edit();

            Intent intent = new Intent();
            intent.setClassName("com.huawei.systemmanager", "com.huawei.systemmanager.optimize.process.ProtectActivity");

            if (isCallable(intent)) {
                final AppCompatCheckBox dontShowAgain = new AppCompatCheckBox(this);
                dontShowAgain.setText(getString(R.string.protected_apps_skip));
                dontShowAgain.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                    @Override
                    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                        editor.putBoolean("protected_apps", isChecked);
                        editor.apply();
                    }
                });

                new AlertDialog.Builder(this)
                        .setTitle(getString(R.string.protected_apps_dialog_title))
                        .setMessage(String.format(getString(R.string.protected_apps_dialog_message), getString(R.string.app_name)))
                        .setView(dontShowAgain)
                        .setPositiveButton(getString(R.string.protected_apps_button), new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                                huaweiProtectedApps();
                            }
                        })
                        .setNegativeButton(R.string.close_button, null)
                        .show();
            }
            else {
                editor.putBoolean("protected_apps", true);
                editor.apply();
            }
        }
    }
}
 
开发者ID:tomatrocho,项目名称:insapp-android,代码行数:41,代码来源:MainActivity.java

示例10: ViewHolder

import android.support.v7.widget.AppCompatCheckBox; //导入方法依赖的package包/类
public ViewHolder(View itemView)
{
    super(itemView);
    tv_feature_name = (AppCompatTextView) itemView.findViewById(R.id.tv_feature_name);
    cb_select = (AppCompatCheckBox) itemView.findViewById(R.id.cb_select);
    cb_select.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener()
    {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b)
        {
            mCheckedStates.set(getLayoutPosition(), b);
        }
    });
}
 
开发者ID:lynnchurch,项目名称:SwipeRefreshPlusLayout,代码行数:15,代码来源:CheckedAdapter.java

示例11: ifHuaweiAlert

import android.support.v7.widget.AppCompatCheckBox; //导入方法依赖的package包/类
private void ifHuaweiAlert() {
    final SharedPreferences settings = getSharedPreferences("ProtectedApps", MODE_PRIVATE);
    final String saveIfSkip = "skipProtectedAppsMessage";
    boolean skipMessage = settings.getBoolean(saveIfSkip, false);
    if (!skipMessage) {
        final SharedPreferences.Editor editor = settings.edit();
        Intent intent = new Intent();
        intent.setClassName("com.huawei.systemmanager", "com.huawei.systemmanager.optimize.process.ProtectActivity");
        if (isCallable(intent)) {
            final AppCompatCheckBox dontShowAgain = new AppCompatCheckBox(this);
            dontShowAgain.setText(R.string.text_huawei_dont_show_again);
            dontShowAgain.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    editor.putBoolean(saveIfSkip, isChecked);
                    editor.apply();
                }
            });

            new AlertDialog.Builder(this)
                    .setIcon(android.R.drawable.ic_dialog_alert)
                    .setTitle(getString(R.string.title_huawei_message))
                    .setMessage(getString(R.string.text_huawei_message))
                    .setView(dontShowAgain)
                    .setPositiveButton(getString(R.string.button_huawei_message), new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            huaweiProtectedApps();
                        }
                    })
                    .setNegativeButton(android.R.string.cancel, null)
                    .show();
        } else {
            editor.putBoolean(saveIfSkip, true);
            editor.apply();
        }
    }
}
 
开发者ID:coderswithoutborders,项目名称:deglancer,代码行数:38,代码来源:MainActivity.java

示例12: initViewDefault

import android.support.v7.widget.AppCompatCheckBox; //导入方法依赖的package包/类
private View initViewDefault(LayoutInflater inflater, ViewGroup parent) {
    RadioGroup radioGroup = new RadioGroup(inflater.getContext());
    radioGroup.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE);
    radioGroup.setDividerDrawable(ContextCompat.getDrawable(parent.getContext(),
            R.drawable.rsb_divider_empty_8dp));

    for (int i = 0; i < choices.length; i++) {
        Choice<T> item = choices[i];

        // Create & add the View to our body-view
        AppCompatCheckBox checkBox = (AppCompatCheckBox) inflater.inflate(R.layout.rsb_item_checkbox,
                radioGroup,
                false);
        checkBox.setText(item.getText());
        checkBox.setId(i);
        radioGroup.addView(checkBox);

        // Set initial state
        if (currentSelected.contains(item.getValue())) {
            checkBox.setChecked(true);
        }

        // Update result when value changes
        checkBox.setOnCheckedChangeListener((buttonView, isChecked) -> {

            if (isChecked) {
                currentSelected.add(item.getValue());
            } else {
                currentSelected.remove(item.getValue());
            }
        });
    }

    return radioGroup;
}
 
开发者ID:ResearchStack,项目名称:ResearchStack,代码行数:36,代码来源:MultiChoiceQuestionBody.java

示例13: initLoginDialogViews

import android.support.v7.widget.AppCompatCheckBox; //导入方法依赖的package包/类
private void initLoginDialogViews(View loginDialogView) {

        usernameEditText = (AppCompatEditText) loginDialogView.findViewById(R.id.edit_text_dialog_ftp_username);
        passwordEditText = (AppCompatEditText) loginDialogView.findViewById(R.id.edit_text_dialog_ftp_password);
        usernameTextInput = (TextInputLayout) loginDialogView.findViewById(R.id.text_input_dialog_ftp_username);
        passwordTextInput = (TextInputLayout) loginDialogView.findViewById(R.id.text_input_dialog_ftp_password);
        mAnonymousCheckBox = (AppCompatCheckBox) loginDialogView.findViewById(R.id.checkbox_ftp_anonymous);
        mSecureCheckBox = (AppCompatCheckBox) loginDialogView.findViewById(R.id.checkbox_ftp_secure);

        mAnonymousCheckBox.setOnCheckedChangeListener((buttonView, isChecked) -> {
            if (isChecked) {
                usernameEditText.setEnabled(false);
                passwordEditText.setEnabled(false);
            } else {
                usernameEditText.setEnabled(true);
                passwordEditText.setEnabled(true);
            }
        });

        // init dialog views as per preferences
        if (getUsernameFromPreferences().equals(FTPService.DEFAULT_USERNAME)) {
            mAnonymousCheckBox.setChecked(true);
        } else {

            usernameEditText.setText(getUsernameFromPreferences());
            passwordEditText.setText(getPasswordFromPreferences());
        }

        if (getSecurePreference()) {
            mSecureCheckBox.setChecked(true);
        } else mSecureCheckBox.setChecked(false);

        // check if we have a keystore
        InputStream stream = getResources().openRawResource(R.raw.key);
        if (stream == null) {
            mSecureCheckBox.setEnabled(false);
            mSecureCheckBox.setChecked(false);
            setSecurePreference(false);
        }
    }
 
开发者ID:TeamAmaze,项目名称:AmazeFileManager,代码行数:41,代码来源:FTPServerFragment.java

示例14: onCreateDialog

import android.support.v7.widget.AppCompatCheckBox; //导入方法依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Context context = getActivity();

    final AlertDialog.Builder builder = new AlertDialog.Builder(context);
    final LayoutInflater dialogInflater = getActivity().getLayoutInflater();

    final View view = dialogInflater.inflate(R.layout.dialog_create_connection, null, false);
    name = (AppCompatEditText) view.findViewById(R.id.name);
    host = (AppCompatEditText) view.findViewById(R.id.host);
    port = (AppCompatEditText) view.findViewById(R.id.port);
    path = (AppCompatEditText) view.findViewById(R.id.path);
    hostContainer = view.findViewById(R.id.hostContainer);
    pathContainer = view.findViewById(R.id.pathContainer);
    username = (AppCompatEditText) view.findViewById(R.id.username);
    usernameContainer = view.findViewById(R.id.usernameContainer);
    password = (AppCompatEditText) view.findViewById(R.id.password);
    passwordContainer = view.findViewById(R.id.passwordContainer);
    scheme = (AppCompatSpinner) view.findViewById(R.id.scheme);
    anonymous = (AppCompatCheckBox) view.findViewById(R.id.anonymous);
    anonymous.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            usernameContainer.setVisibility(b ? View.GONE : View.VISIBLE);
            passwordContainer.setVisibility(b ? View.GONE : View.VISIBLE);
        }
    });

    if(connection_id != 0){
        NetworkConnection connection =
                NetworkConnection.fromConnectionId(getActivity(), connection_id);

        ArrayAdapter myAdap = (ArrayAdapter) scheme.getAdapter();
        int spinnerPosition = myAdap.getPosition(connection.getScheme().toUpperCase());
        scheme.setSelection(spinnerPosition);

        name.setText(connection.getName());
        host.setText(connection.getHost());
        port.setText(Integer.toString(connection.getPort()));
        path.setText(connection.getPath());
        username.setText(connection.getUserName());
        password.setText(connection.getPassword());
        anonymous.setChecked(connection.isAnonymousLogin());
        if(SERVER.equals(connection.getType())){
            hostContainer.setVisibility(View.GONE);
            pathContainer.setVisibility(View.VISIBLE);
        }
    }
    builder.setTitle( (connection_id == 0 ? "New" : "Edit") + " Connection");
    builder.setView(view);

    builder.setPositiveButton(connection_id == 0 ? "ADD" : "SAVE", new OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            final BaseActivity activity = (BaseActivity) getActivity();

            NetworkConnection networkConnection = getNetworkConnection();
            if(validate(networkConnection)){
                new CreateConnectionTask(activity, networkConnection).executeOnExecutor(
                        ProviderExecutor.forAuthority(ExplorerProvider.AUTHORITY));
            }

        }
    });
    builder.setNegativeButton(android.R.string.cancel, null);

    return builder.create();
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:69,代码来源:CreateConnectionFragment.java

示例15: AlertIfHuaweiDevice

import android.support.v7.widget.AppCompatCheckBox; //导入方法依赖的package包/类
@ReactMethod
public void AlertIfHuaweiDevice(String title, String message, String dontShowAgainText, String positiveText, String negativeText) {
    // read "do not show again" flag
    final SharedPreferences settings = this.getCurrentActivity().getSharedPreferences("ProtectedApps",Context.MODE_PRIVATE);
    final String saveIfSkip = "skipProtectedAppsMessage";
    boolean skipMessage = settings.getBoolean(saveIfSkip, false);
    // Show dialog only when "do not show again" hasn't been enabled yet
    if (!skipMessage) {
        final SharedPreferences.Editor editor = settings.edit();
        Intent intent = new Intent();
        // Check if intent of the Huawei protected apps activity is callable
        intent.setClassName("com.huawei.systemmanager", "com.huawei.systemmanager.optimize.process.ProtectActivity");
        if (isCallable(intent)) {
            // Prepare dialog
            final AppCompatCheckBox dontShowAgain = new AppCompatCheckBox(this.getCurrentActivity());
            dontShowAgain.setText(dontShowAgainText);
            dontShowAgain.setLeft(20);
            dontShowAgain.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    editor.putBoolean(saveIfSkip, isChecked);
                    editor.apply();
                }
            });

            final RelativeLayout layout = new RelativeLayout(this.getCurrentActivity());
            layout.setPadding(50,50,0,0);
            layout.addView(dontShowAgain);

            new AlertDialog.Builder(this.getCurrentActivity())
                    .setIcon(android.R.drawable.ic_dialog_alert)
                    .setTitle(title)
                    .setMessage(message)
                    .setView(layout)
                    .setPositiveButton(positiveText, new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            // Launch huawei Protected Apps Activity
                            huaweiProtectedApps();
                        }
                    })
                    .setNegativeButton(negativeText, null)
                    .show();
        } else {
            // Save "do not show again" flag automatically for non-Huawei devices to prevent unnecessary checks
            editor.putBoolean(saveIfSkip, true);
            editor.apply();
        }
    }
}
 
开发者ID:pgengoux,项目名称:react-native-huawei-protected-apps,代码行数:50,代码来源:HuaweiProtectedAppsModule.java


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