當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。