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