Java Code Examples for android.support.v7.widget.AppCompatImageButton#setOnClickListener()
The following examples show how to use
android.support.v7.widget.AppCompatImageButton#setOnClickListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java From Android-9-Development-Cookbook with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final AppCompatImageButton imageViewThumbnail = findViewById(R.id.imageViewThumbnail); imageViewThumbnail.setImageBitmap(loadSampledResource(R.drawable.image, 100, 100)); imageViewThumbnail.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { zoomFromThumbnail(imageViewThumbnail); } }); mImageViewExpanded = findViewById(R.id.imageViewExpanded); mImageViewExpanded.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mImageViewExpanded.setVisibility(View.GONE); mImageViewExpanded.setImageBitmap(null); imageViewThumbnail.setVisibility(View.VISIBLE); } }); }
Example 2
Source File: AdBlocksWebViewActivity.java From AdBlockedWebView-Android with MIT License | 6 votes |
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); }
Example 3
Source File: PicDialog.java From PicKing with Apache License 2.0 | 5 votes |
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)); }
Example 4
Source File: AdBlocksWebViewActivity.java From AdBlockedWebView-Android with MIT License | 5 votes |
@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(); }
Example 5
Source File: FrequencyButtonView.java From KernelAdiutor with GNU General Public License v3.0 | 5 votes |
@Override public void onCreateView(View view) { AppCompatImageButton refresh = view.findViewById(R.id.frequency_refresh); AppCompatImageButton reset = view.findViewById(R.id.frequency_reset); AppCompatImageButton restore = view.findViewById(R.id.frequency_restore); refresh.setOnClickListener(v -> { rotate(v, false); if (mRefreshListener != null) { mRefreshListener.onClick(v); } }); reset.setOnClickListener(v -> { rotate(v, true); if (mResetListener != null) { mResetListener.onClick(v); } }); restore.setOnClickListener(v -> { rotate(v, true); if (mRestoreListener != null) { mRestoreListener.onClick(v); } }); setFullSpan(true); super.onCreateView(view); }
Example 6
Source File: LyricsViewFragment.java From QuickLyric with GNU General Public License v3.0 | 5 votes |
@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); } }); } }
Example 7
Source File: WebFragment.java From PowerFileExplorer with GNU General Public License v3.0 | 4 votes |
protected void bindViews() { View view = getView(); coordinatorLayout = (CoordinatorLayout) view.findViewById(R.id.coordinatorLayout); appBar = (AppBarLayout) view.findViewById(R.id.appBar); toolbar = (Toolbar) view.findViewById(R.id.toolbar); toolbarLayout = (RelativeLayout) view.findViewById(R.id.toolbarLayout); titleHtml = (TextView) view.findViewById(R.id.title); urlTv = (TextView) view.findViewById(R.id.url); close = (AppCompatImageButton) view.findViewById(R.id.close); back = (AppCompatImageButton) view.findViewById(R.id.back); forward = (AppCompatImageButton) view.findViewById(R.id.forward); more = (AppCompatImageButton) view.findViewById(R.id.more); close.setOnClickListener(this); back.setOnClickListener(this); forward.setOnClickListener(this); more.setOnClickListener(this); swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipeRefreshLayout); gradient = view.findViewById(R.id.gradient); divider = view.findViewById(R.id.divider); progressBar = (ProgressBar) view.findViewById(R.id.progressBar); menuLayout = (RelativeLayout) view.findViewById(R.id.menuLayout); shadowLayout = (ShadowLayout) view.findViewById(R.id.shadowLayout); menuBackground = (LinearLayout) view.findViewById(R.id.menuBackground); menuLayout.setOnClickListener(this); menuRefresh = (LinearLayout) view.findViewById(R.id.menuRefresh); menuRefreshTv = (TextView) view.findViewById(R.id.menuRefreshTv); menuFind = (LinearLayout) view.findViewById(R.id.menuFind); menuFindTv = (TextView) view.findViewById(R.id.menuFindTv); menuShareVia = (LinearLayout) view.findViewById(R.id.menuShareVia); menuShareViaTv = (TextView) view.findViewById(R.id.menuShareViaTv); menuCopyLink = (LinearLayout) view.findViewById(R.id.menuCopyLink); menuCopyLinkTv = (TextView) view.findViewById(R.id.menuCopyLinkTv); menuOpenWith = (LinearLayout) view.findViewById(R.id.menuOpenWith); menuOpenWithTv = (TextView) view.findViewById(R.id.menuOpenWithTv); menuRefresh.setOnClickListener(this); menuFind.setOnClickListener(this); menuShareVia.setOnClickListener(this); menuCopyLink.setOnClickListener(this); menuOpenWith.setOnClickListener(this); webLayout = (FrameLayout) view.findViewById(R.id.webLayout); webView = new WebView(getContext()); webLayout.addView(webView); }