android.support.v7.widget.AppCompatImageButton Java Examples
The following examples show how to use
android.support.v7.widget.AppCompatImageButton.
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: AddViewsByJavaActivity.java From Skeleton with Apache License 2.0 | 6 votes |
void matchView() { // Bind view RelativeLayout mainLayout4 = findViewById(R.id.mainLayout4); AppCompatImageButton btn7 = findViewById(R.id.btn7); AppCompatImageButton btn8 = findViewById(R.id.btn8); SkeletonViewGroup skeletonViewGroup = new SkeletonViewGroup(getApplicationContext()); ArrayList<SkeletonModel> skeletonModels = new ArrayList<>(); // Add Btn 1 skeletonModels.add(new SkeletonModelBuilder() .setChildView(btn7) .setIsMatchViewBoolean(true) //MatchView .build()); skeletonViewGroup.setSkeletonModels(skeletonModels); // Add SkeletonGroup ViewGroup.LayoutParams layout = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); mainLayout4.addView(skeletonViewGroup, layout); }
Example #4
Source File: AddViewsByJavaActivity.java From Skeleton with Apache License 2.0 | 6 votes |
void customWidthAndHeightSkeleton() { // Bind view RelativeLayout mainLayout3 = findViewById(R.id.mainLayout3); AppCompatImageButton btn5 = findViewById(R.id.btn5); AppCompatImageButton btn6 = findViewById(R.id.btn6); SkeletonViewGroup skeletonViewGroup = new SkeletonViewGroup(getApplicationContext()); ArrayList<SkeletonModel> skeletonModels = new ArrayList<>(); // Add Btn 1 skeletonModels.add(new SkeletonModelBuilder() .setChildView(btn5)// AddView .setCustomWidth(ConverterUnitUtil.dpToPx(getApplicationContext(), 140f)) // CustomWidth .setCustomHeight(ConverterUnitUtil.dpToPx(getApplicationContext(), 50f)) // CustomHeight .build()); skeletonViewGroup.setSkeletonModels(skeletonModels); // Add SkeletonGroup ViewGroup.LayoutParams layout = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); mainLayout3.addView(skeletonViewGroup, layout); }
Example #5
Source File: AddViewsByJavaActivity.java From Skeleton with Apache License 2.0 | 6 votes |
void startAndEndViewsSkeleton() { // Bind view RelativeLayout mainLayout2 = findViewById(R.id.mainLayout2); AppCompatImageButton btn3 = findViewById(R.id.btn3); AppCompatImageButton btn4 = findViewById(R.id.btn4); SkeletonViewGroup skeletonViewGroup = new SkeletonViewGroup(getApplicationContext()); ArrayList<SkeletonModel> skeletonModels = new ArrayList<>(); // Add Btn 1 and Btn 2 skeletonModels.add(new SkeletonModelBuilder() .setStartView(btn3) // AddView start .setEndView(btn4)// AddView end .build()); skeletonViewGroup.setSkeletonModels(skeletonModels); // Add SkeletonGroup ViewGroup.LayoutParams layout = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); mainLayout2.addView(skeletonViewGroup, layout); }
Example #6
Source File: ToolbarIconClick.java From Material-Backdrop-Android with MIT License | 6 votes |
@Override public void onClick(View v) { if (toolbaricon==null){ this.toolbaricon=(AppCompatImageButton) v; } dropped=!dropped; animatorSet.removeAllListeners(); animatorSet.end(); animatorSet.cancel(); updateIcon(v); ObjectAnimator objectAnimator=ObjectAnimator.ofFloat(frontlayer,"translationY", dropped? translate:0); animatorSet.play(objectAnimator); objectAnimator.setDuration(anim_duration); objectAnimator.setInterpolator(interpolator); objectAnimator.start(); }
Example #7
Source File: AddViewsByJavaActivity.java From Skeleton with Apache License 2.0 | 5 votes |
void simpleSkeleton() { // Bind view RelativeLayout mainLayout1 = findViewById(R.id.mainLayout1); AppCompatImageButton btn1 = findViewById(R.id.btn1); AppCompatImageButton btn2 = findViewById(R.id.btn2); SkeletonViewGroup skeletonViewGroup = new SkeletonViewGroup(getApplicationContext()); ArrayList<SkeletonModel> skeletonModels = new ArrayList<>(); // Add Btn 1 skeletonModels.add(new SkeletonModelBuilder() .setChildView(btn1) // AddView .build()); // Add Btn 2 skeletonModels.add(new SkeletonModelBuilder() .setChildView(btn2) // AddView .build()); skeletonViewGroup.setSkeletonModels(skeletonModels); // Add SkeletonGroup ViewGroup.LayoutParams layout = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); mainLayout1.addView(skeletonViewGroup, layout); }
Example #8
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 #9
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 #10
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 #11
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 #12
Source File: FavoriteAdapter.java From PicKing with Apache License 2.0 | 4 votes |
public MyViewHolder(View itemView) { super(itemView); simpleDraweeView = (SimpleDraweeView) itemView.findViewById(R.id.fresco); simpleDraweeView.getHierarchy().setProgressBarImage(new ProgressBarDrawable()); imageButton = (AppCompatImageButton) itemView.findViewById(R.id.love_button); }
Example #13
Source File: DetailAdapter.java From PicKing with Apache License 2.0 | 4 votes |
public MyViewHolder(View itemView) { super(itemView); simpleDraweeView = (SimpleDraweeView) itemView.findViewById(R.id.fresco); simpleDraweeView.getHierarchy().setProgressBarImage(new ProgressBarDrawable()); imageButton = (AppCompatImageButton) itemView.findViewById(R.id.love_button); }
Example #14
Source File: TextFieldBoxes.java From TextFieldBoxes with Apache License 2.0 | 4 votes |
public AppCompatImageButton getIconImageButton() { return this.iconImageButton; }
Example #15
Source File: TextFieldBoxes.java From TextFieldBoxes with Apache License 2.0 | 4 votes |
public AppCompatImageButton getEndIconImageButton() { return this.endIconImageButton; }
Example #16
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); }
Example #17
Source File: AnnounceFragment.java From ForPDA with GNU General Public License v3.0 | 4 votes |
private void addSearchOnPageItem(Menu menu) { toolbar.inflateMenu(R.menu.theme_search_menu); MenuItem searchOnPageMenuItem = menu.findItem(R.id.action_search); searchOnPageMenuItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS); SearchView searchView = (SearchView) searchOnPageMenuItem.getActionView(); searchView.setTag(searchViewTag); searchView.setOnSearchClickListener(v -> { if (searchView.getTag().equals(searchViewTag)) { ImageView searchClose = (ImageView) searchView.findViewById(android.support.v7.appcompat.R.id.search_close_btn); if (searchClose != null) ((ViewGroup) searchClose.getParent()).removeView(searchClose); ViewGroup.LayoutParams navButtonsParams = new ViewGroup.LayoutParams(App.px48, App.px48); TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.actionBarItemBackground, outValue, true); AppCompatImageButton btnNext = new AppCompatImageButton(searchView.getContext()); btnNext.setImageDrawable(App.getVecDrawable(getContext(), R.drawable.ic_toolbar_search_next)); btnNext.setBackgroundResource(outValue.resourceId); AppCompatImageButton btnPrev = new AppCompatImageButton(searchView.getContext()); btnPrev.setImageDrawable(App.getVecDrawable(getContext(), R.drawable.ic_toolbar_search_prev)); btnPrev.setBackgroundResource(outValue.resourceId); ((LinearLayout) searchView.getChildAt(0)).addView(btnPrev, navButtonsParams); ((LinearLayout) searchView.getChildAt(0)).addView(btnNext, navButtonsParams); btnNext.setOnClickListener(v1 -> findNext(true)); btnPrev.setOnClickListener(v1 -> findNext(false)); searchViewTag++; } }); SearchManager searchManager = (SearchManager) getMainActivity().getSystemService(Context.SEARCH_SERVICE); if (null != searchManager) { searchView.setSearchableInfo(searchManager.getSearchableInfo(getMainActivity().getComponentName())); } searchView.setIconifiedByDefault(true); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String newText) { findText(newText); return false; } }); }
Example #18
Source File: ForumRulesFragment.java From ForPDA with GNU General Public License v3.0 | 4 votes |
private void addSearchOnPageItem(Menu menu) { toolbar.inflateMenu(R.menu.theme_search_menu); MenuItem searchOnPageMenuItem = menu.findItem(R.id.action_search); searchOnPageMenuItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS); /*MenuItemCompat.setOnActionExpandListener(searchOnPageMenuItem, new MenuItemCompat.OnActionExpandListener() { @Override public boolean onMenuItemActionCollapse(MenuItem item) { toggleMessagePanelItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS); return true; } @Override public boolean onMenuItemActionExpand(MenuItem item) { toggleMessagePanelItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_NEVER); return true; } });*/ SearchView searchView = (SearchView) searchOnPageMenuItem.getActionView(); searchView.setTag(searchViewTag); searchView.setOnSearchClickListener(v -> { if (searchView.getTag().equals(searchViewTag)) { ImageView searchClose = (ImageView) searchView.findViewById(android.support.v7.appcompat.R.id.search_close_btn); if (searchClose != null) ((ViewGroup) searchClose.getParent()).removeView(searchClose); ViewGroup.LayoutParams navButtonsParams = new ViewGroup.LayoutParams(App.px48, App.px48); TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.actionBarItemBackground, outValue, true); AppCompatImageButton btnNext = new AppCompatImageButton(searchView.getContext()); btnNext.setImageDrawable(App.getVecDrawable(getContext(), R.drawable.ic_toolbar_search_next)); btnNext.setBackgroundResource(outValue.resourceId); AppCompatImageButton btnPrev = new AppCompatImageButton(searchView.getContext()); btnPrev.setImageDrawable(App.getVecDrawable(getContext(), R.drawable.ic_toolbar_search_prev)); btnPrev.setBackgroundResource(outValue.resourceId); ((LinearLayout) searchView.getChildAt(0)).addView(btnPrev, navButtonsParams); ((LinearLayout) searchView.getChildAt(0)).addView(btnNext, navButtonsParams); btnNext.setOnClickListener(v1 -> findNext(true)); btnPrev.setOnClickListener(v1 -> findNext(false)); searchViewTag++; } }); SearchManager searchManager = (SearchManager) getMainActivity().getSystemService(Context.SEARCH_SERVICE); if (null != searchManager) { searchView.setSearchableInfo(searchManager.getSearchableInfo(getMainActivity().getComponentName())); } searchView.setIconifiedByDefault(true); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String newText) { findText(newText); return false; } }); }
Example #19
Source File: AppCompatv7DSL.java From anvil with MIT License | 4 votes |
public static BaseDSL.ViewClassResult appCompatImageButton() { return BaseDSL.v(AppCompatImageButton.class); }
Example #20
Source File: AppCompatv7DSL.java From anvil with MIT License | 4 votes |
public static Void appCompatImageButton(Anvil.Renderable r) { return BaseDSL.v(AppCompatImageButton.class, r); }
Example #21
Source File: PagerSlidingTabStrip.java From FriendBook with GNU General Public License v3.0 | 3 votes |
private void addIconTab(final int position, int resId) { ImageButton tab = new AppCompatImageButton(getContext()); tab.setImageResource(resId); addTab(position, tab); }