微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android.support.v7.widget.AppCompatImageButton的实例源码

项目:whatanime-android    文件MainActivity.java   
private void setupViews() {
    drawer = (DrawerLayout) findViewById(R.id.drawerlayout);
    navview = (NavigationView) findViewById(R.id.navview);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this,drawer,toolbar,R.string.main_drawer_open,R.string.main_drawer_close);
    //drawer.addDrawerListener(this);
    toggle.syncState();
    navview.setNavigationItemSelectedListener(this);

    View _view = findViewById(R.id.bottom_search_results);
    resultsBottom = BottomSheetBehavior.from(_view);
    resultsBottom.setHideable(true);
    resultsBottom.setState(BottomSheetBehavior.STATE_HIDDEN);
    resultsRv = (RecyclerView) findViewById(R.id.rv_results);
    resultsRv.setLayoutManager(new linearlayoutmanager(MainActivity.this,linearlayoutmanager.VERTICAL,false));
    photoIv = (SquareImageView) findViewById(R.id.iv_photo);
    searchFab = (FloatingActionButton) findViewById(R.id.fab_search);
    closeBottomBtn = (AppCompatimageButton) findViewById(R.id.btn_close_bottom);
    indicatorLoadingLayout = (LinearLayout) findViewById(R.id.layout_main_loading);
    indicatorStatusTv = (AppCompatTextView) findViewById(R.id.tv_progress_status);
    AppCompatTextView versionAppTv = navview.getHeaderView(0).findViewById(R.id.tv_header_app_version);
    versionAppTv.setText(C.getAppVersion(MainActivity.this));
}
项目:AdBlockedWebView-Android    文件AdBlocksWebViewActivity.java   
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);
}
项目:webviewer-android    文件WebViewerActivity.java   
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);
}
项目:telepathy-android    文件UserMessageAdapter.java   
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());
            }
        }
    });
}
项目:FRC-Krawler    文件StopwatchMetricWidget.java   
@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();
        }
    });
}
项目:collect-mobile    文件TimeAttributeComponent.java   
private View createButton() {
        ImageButton button = new AppCompatimageButton(context);
        view.setLayoutParams(new LinearLayout.LayoutParams(WRAP_CONTENT,WRAP_CONTENT));
        button.setimageResource(new Attrs(context).resourceId(R.attr.timeIcon));
//
        button.setonClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                saveNode();
                TimePickerFragment newFragment = new TimePickerFragment();
                newFragment.setComponent(TimeAttributeComponent.this);
                newFragment.show(context.getSupportFragmentManager(),"timePicker");

            }
        });
        return button;
    }
项目:discogsbrowser    文件TestUtils.java   
/**
 * A matcher to get the ActionBar home/hamburger button.
 * <p>
 * Taken from: http://stackoverflow.com/a/34658817/4624156
 *
 * @return Matcher.
 */
public static Matcher<View> getHamburgerButton()
{
    return allOf(
            withParent(withClassName(is(Toolbar.class.getName()))),withClassName(anyOf(is(ImageButton.class.getName()),is(AppCompatimageButton.class.getName()))));
}
项目:LiteReader    文件JToolBar.java   
/**
 * Note that to use this method rather than {@link Toolbar#setNavigationIcon(int)},as this method will expand the click area.
 *
 * @param icon the navigation icon.
 */
public void setNavIcon(@DrawableRes int icon) {
    setNavigationIcon(icon);
    AppCompatimageButton navIcon = (AppCompatimageButton) getChildAt(1);
    Toolbar.LayoutParams lp = (LayoutParams) navIcon.getLayoutParams();
    lp.width = ViewGroup.LayoutParams.WRAP_CONTENT;
    lp.height = ViewGroup.LayoutParams.MATCH_PARENT;
    navIcon.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
    navIcon.setLayoutParams(lp);
}
项目:PicKing    文件PicDialog.java   
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));
}
项目:Skeleton    文件AdapterSample1.java   
ViewHolder(View itemView) {
    super(itemView);

    cardView = (CardView) itemView.findViewById(R.id.cardView);
    skeletonGroup = (SkeletonGroup) itemView.findViewById(R.id.skeletonGroup);
    photoACImgV = (AppCompatimageView) itemView.findViewById(R.id.photoACImgV);
    newFlagTv = (TextView) itemView.findViewById(R.id.newFlagTv);
    titleTv = (TextView) itemView.findViewById(R.id.titleTv);
    descriptionTv = (TextView) itemView.findViewById(R.id.descriptionTv);
    addToParkingImgBtn = (AppCompatimageButton) itemView.findViewById(R.id.addToParkingImgBtn);
    compareImgBtn = (AppCompatimageButton) itemView.findViewById(R.id.compareImgBtn);
    priceTv = (TextView) itemView.findViewById(R.id.priceTv);

}
项目:Skeleton    文件AdapterSample2.java   
ViewHolder(View itemView) {
    super(itemView);

    cardView = (CardView) itemView.findViewById(R.id.cardView);
    skeletonGroup = (SkeletonGroup) itemView.findViewById(R.id.skeletonGroup);
    photoACImgV = (AppCompatimageView) itemView.findViewById(R.id.photoACImgV);
    newFlagTv = (TextView) itemView.findViewById(R.id.newFlagTv);
    titleTv = (TextView) itemView.findViewById(R.id.titleTv);
    descriptionTv = (TextView) itemView.findViewById(R.id.descriptionTv);
    addToParkingImgBtn = (AppCompatimageButton) itemView.findViewById(R.id.addToParkingImgBtn);
    compareImgBtn = (AppCompatimageButton) itemView.findViewById(R.id.compareImgBtn);
    priceTv = (TextView) itemView.findViewById(R.id.priceTv);

}
项目:Skeleton    文件AdapterSample3.java   
ViewHolder(View itemView) {
    super(itemView);

    cardView = (CardView) itemView.findViewById(R.id.cardView);
    skeletonGroup = (SkeletonGroup) itemView.findViewById(R.id.skeletonGroup);
    photoACImgV = (AppCompatimageView) itemView.findViewById(R.id.photoACImgV);
    newFlagTv = (TextView) itemView.findViewById(R.id.newFlagTv);
    titleTv = (TextView) itemView.findViewById(R.id.titleTv);
    descriptionTv = (TextView) itemView.findViewById(R.id.descriptionTv);
    addToParkingImgBtn = (AppCompatimageButton) itemView.findViewById(R.id.addToParkingImgBtn);
    compareImgBtn = (AppCompatimageButton) itemView.findViewById(R.id.compareImgBtn);
    priceTv = (TextView) itemView.findViewById(R.id.priceTv);

}
项目:FamilyBond    文件MapActivity.java   
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);
}
项目:HeadsOff    文件Whitelistadapter.java   
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);
}
项目:AdBlockedWebView-Android    文件AdBlocksWebViewActivity.java   
@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();
}
项目:webviewer-android    文件WebViewerActivity.java   
@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();
}
项目:vertical-stepper-form    文件VerticalStepperFormlayout.java   
protected void findViews() {
    content = (LinearLayout) findViewById(R.id.content);
    stepsScrollView = (ScrollView) findViewById(R.id.steps_scroll);
    progressBar = (ProgressBar) findViewById(R.id.progress_bar);
    prevIoUsstepButton = (AppCompatimageButton) findViewById(R.id.down_prevIoUs);
    nextStepButton = (AppCompatimageButton) findViewById(R.id.down_next);
    bottomNavigation = (RelativeLayout) findViewById(R.id.bottom_navigation);
}
项目:Type    文件MainActivity.java   
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());
                }
            });
}
项目:IsPhoneEncrypted    文件MainActivity.java   
@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()));
    }
}
项目:introduction    文件ButtonManager.java   
/**
 * @param prevIoUs           The Button to navigate one slide back.
 * @param next               The Button to navigate one slide forth. Also used to show the done icon,if the
 *                           current Slide is the last Slide.
 * @param skip               The Button to skip the introduction.
 * @param showPrevIoUsButton If the Button to navigate back should not be shown,pass false.
 * @param showSkipButton     If the Button for skipping should not be shown,pass false.
 * @param slideAmount        The amount of Slides.
 */
public ButtonManager(@NonNull AppCompatimageButton prevIoUs,@NonNull AppCompatimageButton next,@NonNull Button skip,boolean showPrevIoUsButton,boolean showSkipButton,int slideAmount) {
    this.prevIoUs = prevIoUs;
    this.next = next;
    this.skip = skip;
    this.showPrevIoUsButton = showPrevIoUsButton;
    this.showSkipButton = showSkipButton;
    this.slideAmount = slideAmount;

    init();
}
项目:CodeColors    文件AppCompatDefStyleHandler.java   
@SuppressLint({"PrivateResource","InlinedApi"})
@Override
protected int getdefaultviewDefStyleAttr(View view) {
    if (view instanceof AppCompaTradioButton) {
        return R.attr.radioButtonStyle;
    } else if (view instanceof AppCompatCheckBox) {
        return R.attr.checkBoxStyle;
    } else if (view instanceof AppCompatButton) {
        return R.attr.buttonStyle;
    } else if (view instanceof AppCompatMultiAutoCompleteTextView) {
        return R.attr.autoCompleteTextViewStyle;
    } else if (view instanceof AppCompatAutoCompleteTextView) {
        return R.attr.autoCompleteTextViewStyle;
    } else if (view instanceof AppCompatEditText) {
        return R.attr.editTextStyle;
    } else if (view instanceof AppCompatCheckedTextView) {
        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 ?
                android.R.attr.checkedTextViewStyle : 0;
    } else if (view instanceof AppCompatTextView) {
        return android.R.attr.textViewStyle;
    } else if (view instanceof AppCompatSpinner) {
        return R.attr.spinnerStyle;
    } else if (view instanceof AppCompatimageButton) {
        return R.attr.imageButtonStyle;
    } else if (view instanceof AppCompatratingBar) {
        return R.attr.ratingBarStyle;
    } else if (view instanceof AppCompatSeekBar) {
        return R.attr.seekBarStyle;
    } else {
        return super.getdefaultviewDefStyleAttr(view);
    }
}
项目:collect-mobile    文件DateAttributeComponent.java   
private View createButton() {
    ImageButton button = new AppCompatimageButton(context);
    view.setLayoutParams(new LinearLayout.LayoutParams(WRAP_CONTENT,WRAP_CONTENT));
    button.setimageResource(new Attrs(context).resourceId(R.attr.goToTodayIcon));
    button.setonClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            saveNode();
            DatePickerFragment newFragment = new DatePickerFragment();
            newFragment.setComponent(DateAttributeComponent.this);
            newFragment.show(context.getSupportFragmentManager(),"datePicker");

        }
    });
    return button;
}
项目:QuickLyric    文件LyricsViewFragment.java   
@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,nlsWarning.getMeasuredHeight());
                nlsWarning.getViewTreeObserver().removeGlobalOnLayoutListener(this);
            }
        });
    }
}
项目:calendula    文件NumberPadView.java   
private void initView() {
    // inflate numpad
    numpadLayout = (GridLayout) inflate(getContext(),R.layout.view_num_pad,null);
    addView(numpadLayout);
    // set icon for the delete button
    final AppCompatimageButton deleteButton = (AppCompatimageButton) numpadLayout.findViewById(R.id.numpad_delete_btn);
    final IconicsDrawable deleteIcon = IconUtils.icon(getContext(),GoogleMaterial.Icon.gmd_tag_backspace,R.color.white,20);
    deleteButton.setimageDrawable(deleteIcon);
    // add listeners
    for (int i = 0; i < numpadLayout.getChildCount(); i++) {
        numpadLayout.getChildAt(i).setonClickListener(new NumpadButtonListener());
    }
}
项目:PicKing    文件FavoriteAdapter.java   
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);
}
项目:PicKing    文件DetailAdapter.java   
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);
}
项目:TextFieldBoxes    文件TextFieldBoxes.java   
public AppCompatimageButton getIconImageButton() {
    return this.iconImageButton;
}
项目:TextFieldBoxes    文件TextFieldBoxes.java   
public AppCompatimageButton getEndIconImageButton() {
    return this.endIconImageButton;
}
项目:ForPDA    文件AnnounceFragment.java   
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;
        }
    });
}
项目:ForPDA    文件ForumRulesFragment.java   
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,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;
        }
    });
}
项目:collect-mobile    文件NodeParentsFragment.java   
private View createSurveyButton() {
    ImageButton button = new AppCompatimageButton(getActivity());
    button.setimageResource(R.drawable.ic_menu_home);
    return button;
}
项目:FriendBook    文件PagerSlidingTabStrip.java   
private void addIconTab(final int position,int resId) {

        ImageButton tab = new AppCompatimageButton(getContext());
        tab.setimageResource(resId);

        addTab(position,tab);

    }
项目:PhoneProfilesPlus    文件GlobalGUIRoutines.java   
/**
 * Sets the specified image button to the given state,while modifying or
 * "graying-out" the icon as well
 *
 * @param enabled The state of the menu item
 * @param item The menu item to modify
 * @param iconResId The icon ID
 */
static void setimageButtonEnabled(boolean enabled,AppCompatimageButton item,int iconResId,Context context) {
    item.setEnabled(enabled);
    Drawable originalIcon = ContextCompat.getDrawable(context,iconResId);
    Drawable icon = enabled ? originalIcon : convertDrawabletoGrayScale(originalIcon);
    item.setimageDrawable(icon);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。