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


Java AppCompatImageButton.setOnClickListener方法代码示例

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


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

示例1: initPopupMenu

import android.support.v7.widget.AppCompatImageButton; //导入方法依赖的package包/类
private void initPopupMenu() {
    @SuppressLint("InflateParams")
    View view = LayoutInflater.from(this).inflate(R.layout.popup_menu, null);
    mPopupMenu = new PopupWindow(this);
    mPopupMenu.setBackgroundDrawable(new BitmapDrawable());
    mPopupMenu.setContentView(view);
    mPopupMenu.setOutsideTouchable(true);
    mPopupMenu.setFocusable(true);

    mLlControlButtons = (RelativeLayout) view.findViewById(R.id.popup_menu_rl_arrows);
    mBtnBack = (AppCompatImageButton) view.findViewById(R.id.popup_menu_btn_back);
    mBtnFoward = (AppCompatImageButton) view.findViewById(R.id.popup_menu_btn_forward);

    mBtnBack.setOnClickListener(this);
    mBtnFoward.setOnClickListener(this);
    view.findViewById(R.id.popup_menu_btn_refresh).setOnClickListener(this);
    view.findViewById(R.id.popup_menu_btn_copy_link).setOnClickListener(this);
    view.findViewById(R.id.popup_menu_btn_open_with_other_browser).setOnClickListener(this);
    view.findViewById(R.id.popup_menu_btn_share).setOnClickListener(this);
}
 
开发者ID:AmniX,项目名称:AdBlockedWebView-Android,代码行数:21,代码来源:AdBlocksWebViewActivity.java

示例2: initPopupMenu

import android.support.v7.widget.AppCompatImageButton; //导入方法依赖的package包/类
private void initPopupMenu() {
    @SuppressLint("InflateParams")
    View view = LayoutInflater.from(this).inflate(R.layout.popup_menu, null);

    mPopupMenu = new PopupWindow(this);

    mPopupMenu.setContentView(view);
    mPopupMenu.setOutsideTouchable(true);
    mPopupMenu.setBackgroundDrawable(new ColorDrawable(0));
    mPopupMenu.setFocusable(true);

    mLlControlButtons = (RelativeLayout) view.findViewById(R.id.popup_menu_rl_arrows);
    mBtnBack = (AppCompatImageButton) view.findViewById(R.id.popup_menu_btn_back);
    mBtnFoward = (AppCompatImageButton) view.findViewById(R.id.popup_menu_btn_forward);

    mBtnBack.setOnClickListener(this);
    mBtnFoward.setOnClickListener(this);
    view.findViewById(R.id.popup_menu_btn_refresh).setOnClickListener(this);
    view.findViewById(R.id.popup_menu_btn_copy_link).setOnClickListener(this);
    view.findViewById(R.id.popup_menu_btn_open_with_other_browser).setOnClickListener(this);
    view.findViewById(R.id.popup_menu_btn_share).setOnClickListener(this);
}
 
开发者ID:fobid,项目名称:webviewer-android,代码行数:23,代码来源:WebViewerActivity.java

示例3: UserMessageViewHolder

import android.support.v7.widget.AppCompatImageButton; //导入方法依赖的package包/类
public UserMessageViewHolder(View itemView) {
    super(itemView);
    mTxFirstMessageBody = (DetectLTextView) itemView.findViewById(R.id.tx_first_message_body);
    mTxSecondMessageBody = (DetectLTextView) itemView.findViewById(R.id.tx_second_message_body);
    mTxMatchedStatus = (AppCompatTextView) itemView.findViewById(R.id.tx_matched_status);
    mBtnDeleteMessage = (AppCompatImageButton) itemView.findViewById(R.id.btn_delete);
    mTxMessageStatus = (AppCompatTextView) itemView.findViewById(R.id.tx_message_status);
    mTxCrossIn = (AppCompatTextView) itemView.findViewById(R.id.tx_cross_in);
    mVSeparator = itemView.findViewById(R.id.v_separator);
    //handle delete action
    mBtnDeleteMessage.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mUserMessageListener != null) {
                mUserMessageListener.onDeleteMessage(mData.get(getAdapterPosition()).getMessageId(), getAdapterPosition());
            }
        }
    });
}
 
开发者ID:atahani,项目名称:telepathy-android,代码行数:20,代码来源:UserMessageAdapter.java

示例4: initViews

import android.support.v7.widget.AppCompatImageButton; //导入方法依赖的package包/类
@Override
public void initViews() {
    inflater.inflate(R.layout.widget_metric_stopwatch, this);
    startResumeButton = (AppCompatImageButton) findViewById(R.id.start_resume);
    findViewById(R.id.reset).setOnClickListener(v -> reset());
    findViewById(R.id.reset).setVisibility(View.GONE);
    startResumeButton.setOnClickListener(v -> {
        if (!running) {
            startResumeButton.setImageResource(R.drawable.ic_pause_black_48dp);
            start();
        } else {
            startResumeButton.setImageResource(R.drawable.ic_play_arrow_black_48dp);
            stop();
        }
    });
}
 
开发者ID:frc2052,项目名称:FRC-Krawler,代码行数:17,代码来源:StopwatchMetricWidget.java

示例5: PicDialog

import android.support.v7.widget.AppCompatImageButton; //导入方法依赖的package包/类
public PicDialog(Context context) {
    super(context, R.style.AppNoActionBarTheme);
    setOwnerActivity((Activity) context);
    setContentView(R.layout.dialog_pic);

    StatusBarUtil.MIUISetStatusBarLightMode(getOwnerActivity(), true);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        View decorView = getWindow().getDecorView();
        int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
        decorView.setSystemUiVisibility(option);
        getWindow().setStatusBarColor(Color.TRANSPARENT);
    }

    ButterKnife.bind(this);

    if ((boolean) SPUtils.get(getContext(), AppConfig.click_to_back, false))
        photoDraweeView.setOnViewTapListener(new OnViewTapListener() {
            @Override
            public void onViewTap(View view, float x, float y) {
                dismiss();
            }
        });

    photoDraweeView.setAllowParentInterceptOnEdge(false);
    photoDraweeView.setEnableDraweeMatrix(false);

    for (AppCompatImageButton imageButton : imageButtons)
        imageButton.setOnClickListener(this);

    getWindow().setWindowAnimations(R.style.dialogStyle);

    behavior = BottomSheetBehavior.from(findViewById(R.id.bottom_view));
}
 
开发者ID:lanyuanxiaoyao,项目名称:PicKing,代码行数:36,代码来源:PicDialog.java

示例6: initView

import android.support.v7.widget.AppCompatImageButton; //导入方法依赖的package包/类
void initView() {
    mMapView = (MapView) findViewById(R.id.map);
    mLocbtn = (AppCompatImageButton) findViewById(R.id.locbtn);
    mActionLocate = (FloatingActionButton) findViewById(R.id.action_locate);
    mActionSettings = (FloatingActionButton) findViewById(R.id.action_settings);
    mActionReminder = (FloatingActionButton) findViewById(R.id.action_reminder);
    mFloatingActionsMenu = (FloatingActionsMenu) findViewById(R.id.floating_actions_menu);
    mInfoTextView = (TextView) findViewById(R.id.info_text_view);

    mActionLocate.setOnClickListener(this);
    mActionSettings.setOnClickListener(this);
    mActionReminder.setOnClickListener(this);
    mLocbtn.setOnClickListener(this);
}
 
开发者ID:InnoFang,项目名称:FamilyBond,代码行数:15,代码来源:MapActivity.java

示例7: ViewHolder

import android.support.v7.widget.AppCompatImageButton; //导入方法依赖的package包/类
public ViewHolder(View itemView) {
	super(itemView);

	txtRule = (TextView) itemView.findViewById(R.id.txt_rule);
	btnDelete = (AppCompatImageButton) itemView.findViewById(R.id.btn_delete);
	btnDelete.setOnClickListener(this);
}
 
开发者ID:j2rong,项目名称:HeadsOff,代码行数:8,代码来源:WhiteListAdapter.java

示例8: bindView

import android.support.v7.widget.AppCompatImageButton; //导入方法依赖的package包/类
@SuppressLint("SetJavaScriptEnabled")
private void bindView() {
    // Toolbar
    mTvTitle = (TextView) findViewById(R.id.toolbar_tv_title);
    mTvUrl = (TextView) findViewById(R.id.toolbar_tv_url);
    findViewById(R.id.toolbar_root).setBackgroundColor(getIntent().getIntExtra(EXTRA_COLOR, Color.BLACK));

    mCoordinatorLayout = (CoordinatorLayout) findViewById(R.id.a_web_viewer_coordinatorlayout);
    mProgressBar = (ProgressBar) findViewById(R.id.a_web_viewer_pb);
    mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.a_web_viewer_srl);
    mWebView = (WebView) findViewById(R.id.a_web_viewer_wv);
    mSwipeRefreshLayout.setOnRefreshListener(this);

    WebSettings webSettings = mWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        webSettings.setDisplayZoomControls(false);
    }
    webSettings.setBuiltInZoomControls(true);
    webSettings.setSupportZoom(true);
    webSettings.setDomStorageEnabled(true);

    mWebView.setWebChromeClient(new MyWebChromeClient());
    mWebView.setWebViewClient(new MyWebViewClient());
    mWebView.setDownloadListener(this);
    mWebView.setOnCreateContextMenuListener(this);

    mBtnMore = (AppCompatImageButton) findViewById(R.id.toolbar_btn_more);

    //noinspection ConstantConditions
    findViewById(R.id.toolbar_btn_close).setOnClickListener(this);
    //noinspection ConstantConditions
    mBtnMore.setOnClickListener(this);

    // PopupWindow
    initPopupMenu();
}
 
开发者ID:AmniX,项目名称:AdBlockedWebView-Android,代码行数:39,代码来源:AdBlocksWebViewActivity.java

示例9: bindView

import android.support.v7.widget.AppCompatImageButton; //导入方法依赖的package包/类
@SuppressLint("SetJavaScriptEnabled")
private void bindView() {
    // Toolbar
    mTvTitle = (TextView) findViewById(R.id.toolbar_tv_title);
    mTvUrl = (TextView) findViewById(R.id.toolbar_tv_url);

    mCoordinatorLayout = (CoordinatorLayout) findViewById(R.id.a_web_viewer_coordinatorlayout);
    mProgressBar = (ProgressBar) findViewById(R.id.a_web_viewer_pb);
    mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.a_web_viewer_srl);
    mWebView = (WebView) findViewById(R.id.a_web_viewer_wv);
    mSwipeRefreshLayout.setOnRefreshListener(this);

    WebSettings webSettings = mWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        webSettings.setDisplayZoomControls(false);
    }
    webSettings.setBuiltInZoomControls(true);
    webSettings.setSupportZoom(true);
    webSettings.setDomStorageEnabled(true);

    mWebView.setWebChromeClient(new MyWebChromeClient());
    mWebView.setWebViewClient(new MyWebViewClient());
    mWebView.setDownloadListener(this);
    mWebView.setOnCreateContextMenuListener(this);

    mBtnMore = (AppCompatImageButton) findViewById(R.id.toolbar_btn_more);

    //noinspection ConstantConditions
    findViewById(R.id.toolbar_btn_close).setOnClickListener(this);
    //noinspection ConstantConditions
    mBtnMore.setOnClickListener(this);

    // PopupWindow
    initPopupMenu();
}
 
开发者ID:fobid,项目名称:webviewer-android,代码行数:38,代码来源:WebViewerActivity.java

示例10: setupControlPanel

import android.support.v7.widget.AppCompatImageButton; //导入方法依赖的package包/类
private void setupControlPanel() {
    controlPanel = (LinearLayoutCompat) findViewById(R.id.control);
    bulletButton = (StatusImageButton) findViewById(R.id.bullet);
    quoteButton = (StatusImageButton) findViewById(R.id.quote);
    attachmentButton = (AppCompatImageButton) findViewById(R.id.attachment);
    dotsButton = (AppCompatImageButton) findViewById(R.id.dots);
    playButton = (AppCompatImageButton) findViewById(R.id.play);

    bulletButton.setOnClickListener(this);
    quoteButton.setOnClickListener(this);
    attachmentButton.setOnClickListener(this);
    dotsButton.setOnClickListener(this);
    playButton.setOnClickListener(this);

    bulletButton.setOnLongClickListener(this);
    quoteButton.setOnLongClickListener(this);
    attachmentButton.setOnLongClickListener(this);
    dotsButton.setOnLongClickListener(this);
    playButton.setOnLongClickListener(this);

    RxBus.getInstance().toObservable(BlockEvent.class)
            .subscribe(new Action1<BlockEvent>() {
                @Override
                public void call(BlockEvent event) {
                    bulletButton.setActivated(event.isBullet());
                    quoteButton.setActivated(event.isQuote());
                }
            });
}
 
开发者ID:mthli,项目名称:Type,代码行数:30,代码来源:MainActivity.java

示例11: onCreate

import android.support.v7.widget.AppCompatImageButton; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    AppCompatImageButton imageButton = (AppCompatImageButton) findViewById(R.id.imageButton);

    try {

        boolean isEncrypted = getSystemProperty("ro.crypto.state", "").toLowerCase().equals("encrypted");
        if (isEncrypted) {

            /* Positive icon */

            imageButton.setImageResource(R.drawable.ic_check_black_24dp);
            imageButton.setSupportBackgroundTintList(ContextCompat.getColorStateList(this, R.color.green));
            imageButton.setOnClickListener(view -> snack(view, "Disk is fully encrypted :)"));

        } else {

            imageButton.setOnClickListener(view -> snack(view, "Disk is not encrypted :("));

        }

    } catch (Exception e) {

        Log.e(TAG, e.getMessage(), e);

        /* Unknown icon */

        imageButton.setImageResource(R.drawable.ic_warning_black_24dp1);
        // Foreground color
        imageButton.setColorFilter(ContextCompat.getColor(this, R.color.black));
        // Background color
        imageButton.setSupportBackgroundTintList(ContextCompat.getColorStateList(this, R.color.transparent));
        // Listener
        imageButton.setOnClickListener(view -> snack(view, e.getMessage()));
    }
}
 
开发者ID:seguri,项目名称:IsPhoneEncrypted,代码行数:41,代码来源:MainActivity.java

示例12: showBrokenScrobblingWarning

import android.support.v7.widget.AppCompatImageButton; //导入方法依赖的package包/类
@RequiresApi(21)
public void showBrokenScrobblingWarning() {
    if (controllerCallback == null)
        controllerCallback = new MediaControllerCallback(null);
    if (NotificationListenerService.isListeningAuthorized(getActivity()))
        MediaControllerCallback.registerFallbackControllerCallback(getActivity(), controllerCallback);

    String[] manufacturers = new String[]{"XIAOMI", "HUAWEI", "HONOR", "LETV"};
    final boolean canFix = Arrays.asList(manufacturers).contains(Build.BRAND.toUpperCase());
    if (canFix && !PreferenceManager.getDefaultSharedPreferences(getActivity()).getBoolean("nls_warning_removed", false)) {
        final ViewGroup nlsWarning = (ViewGroup) LayoutInflater.from(getActivity()).inflate(R.layout.nls_warning, (ViewGroup) getView(), false);
        AppCompatButton button = nlsWarning.findViewById(R.id.fix_it);
        button.setText(R.string.fix_it);
        button.setOnClickListener(view -> {
            if (!WhiteListUtil.openBootSpecialMenu(getActivity())) {
                MainActivity.startFeedbackActivity(getActivity(), true);
            }
            warningShown = false;
            removePrompt(nlsWarning, false);
        });
        AppCompatImageButton closeButton = nlsWarning.findViewById(R.id.ic_nls_warning_close);
        closeButton.setOnClickListener(view -> {
            removePrompt(nlsWarning, true);
            PreferenceManager.getDefaultSharedPreferences(getActivity()).edit().putBoolean("nls_warning_removed", true).apply();
        });
        ((ViewGroup) getView()).addView(nlsWarning);
        warningShown = true;
        nlsWarning.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
            @Override
            public void onGlobalLayout() {
                if (mRefreshLayout.getProgressViewEndOffset() == 0)
                    mRefreshLayout.setProgressViewOffset(true, 0, nlsWarning.getMeasuredHeight());
                nlsWarning.getViewTreeObserver().removeGlobalOnLayoutListener(this);
            }
        });
    }
}
 
开发者ID:QuickLyric,项目名称:QuickLyric,代码行数:38,代码来源:LyricsViewFragment.java


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