當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageButton.setEnabled方法代碼示例

本文整理匯總了Java中android.widget.ImageButton.setEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageButton.setEnabled方法的具體用法?Java ImageButton.setEnabled怎麽用?Java ImageButton.setEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.ImageButton的用法示例。


在下文中一共展示了ImageButton.setEnabled方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initSendMessage

import android.widget.ImageButton; //導入方法依賴的package包/類
private void initSendMessage() {
    etMessage = findViewById(R.id.inputMessage);

    ImageButton sendButton = findViewById(R.id.sendButton);
    sendButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            sendMessage();
        }
    });

    if (ctype == Chat.ChatType.GROUP && !Utils.getController().getMessengerDatabase().userInChat(Utils.getUserID(), cid)) {
        etMessage.setEnabled(false);
        etMessage.setHint("Du bist nicht in diesem Chat!");
        sendButton.setEnabled(false);
    }
}
 
開發者ID:LCA311,項目名稱:leoapp-sources,代碼行數:18,代碼來源:ChatActivity.java

示例2: onCreateView

import android.widget.ImageButton; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	//final Context context = inflater.getContext();

	final View view = inflater.inflate(R.layout.fragment_move, container, false);
	view.findViewById(R.id.background).setBackgroundColor(SettingsActivity.getPrimaryColor(getActivity()));

	mCancel = (ImageButton) view.findViewById(android.R.id.button2);
	mCancel.setOnClickListener(this);

	mMoveInfo = (TextView) view.findViewById(android.R.id.title);
	mMoveInfo.setText("Paste " + FileUtils.formatFileCount(docs.size()) + " in ");
	mMoveInfo.setEnabled(false);
	
	mRootInfo = (TextView) view.findViewById(android.R.id.text1);

	mSave = (ImageButton) view.findViewById(android.R.id.button1);
	mSave.setOnClickListener(this);
	mSave.setEnabled(false);

	mProgress = (MaterialProgressBar) view.findViewById(android.R.id.progress);
	mProgress.setColor(SettingsActivity.getAccentColor());

	return view;
}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:26,代碼來源:MoveFragment.java

示例3: onCreateView

import android.widget.ImageButton; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	final View view = inflater.inflate(R.layout.fragment_save, container, false);

	view.findViewById(R.id.background).setBackgroundColor(SettingsActivity.getPrimaryColor(getActivity()));

	mCancel = (ImageButton) view.findViewById(android.R.id.button2);
	mCancel.setOnClickListener(this);

	mDisplayName = (EditText) view.findViewById(android.R.id.title);
	mDisplayName.addTextChangedListener(mDisplayNameWatcher);
	mDisplayName.setText(getArguments().getString(EXTRA_DISPLAY_NAME));

	mSave = (ImageButton) view.findViewById(android.R.id.button1);
	mSave.setOnClickListener(this);
	mSave.setEnabled(false);

	mProgress = (ProgressBar) view.findViewById(android.R.id.progress);

	return view;
}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:22,代碼來源:SaveFragment.java

示例4: onBindView

import android.widget.ImageButton; //導入方法依賴的package包/類
@Override
protected void onBindView(View view) {
    super.onBindView(view);

    LinearLayout widgetFrameView = ((LinearLayout) view.findViewById(android.R.id.widget_frame));
    mBtnAppIcon = new ImageButton(mContext);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(mAppIconPreviewSizePx, mAppIconPreviewSizePx);
    lp.gravity = Gravity.CENTER;
    mBtnAppIcon.setLayoutParams(lp);
    mBtnAppIcon.setScaleType(ScaleType.CENTER_CROP);
    mBtnAppIcon.setImageDrawable(mAppInfo.icon);
    mBtnAppIcon.setFocusable(false);
    if (mIconPickerEnabled) {
        mBtnAppIcon.setOnClickListener(this);
        mBtnAppIcon.setOnLongClickListener(this);
    } else {
        mBtnAppIcon.setEnabled(false);
    }
    widgetFrameView.addView(mBtnAppIcon);
    widgetFrameView.setVisibility(View.VISIBLE);
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:22,代碼來源:AppPickerPreference.java

示例5: onCreate

import android.widget.ImageButton; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_post_detail);

    // Get post key from intent
    mPostKey = getIntent().getStringExtra(EXTRA_POST_KEY);
    if (mPostKey == null) {
        throw new IllegalArgumentException("Must pass EXTRA_POST_KEY");
    }

    // Initialize Database
    mPostReference = FirebaseDatabase.getInstance().getReference()
            .child("posts").child(mPostKey);
    mCommentsReference = FirebaseDatabase.getInstance().getReference()
            .child("post-comments").child(mPostKey);

    // Initialize Views
    mAuthorView = (TextView) findViewById(R.id.post_author);
    mTitleView = (TextView) findViewById(R.id.post_title);
    mBodyView = (TextView) findViewById(R.id.post_body);
    mCommentField = (EditText) findViewById(R.id.field_comment_text);
    mCommentButton = (ImageButton) findViewById(R.id.button_post_comment);
    mCommentButton.setEnabled(false);
    if (mCommentField.getText() != null){
        mCommentButton.setEnabled(true);
        mCommentButton.setImageResource(R.drawable.ic_foursquare_button);
    }
    mCommentsRecycler = (RecyclerView) findViewById(R.id.recycler_comments);
    detailedPicture = (ImageView)findViewById(R.id.post_author_photo);
    mCommentButton.setOnClickListener(this);
    mCommentsRecycler.setLayoutManager(new LinearLayoutManager(this));
    authorImage = (ImageView)findViewById(R.id._author_photo);
    authorName = (TextView)findViewById(R.id.author_name);
    authorJob = (TextView)findViewById(R.id.author_job_title);
    aboutTheAuthor = (TextView)findViewById(R.id.author_description_);
    numberOfParticipants = (TextView)findViewById(R.id.number_of_participants);
    timeStampText = (TextView)findViewById(R.id.the_real_fucking_time);

}
 
開發者ID:braulio94,項目名稱:Quadro,代碼行數:41,代碼來源:PostDetailActivity.java

示例6: handleMessage

import android.widget.ImageButton; //導入方法依賴的package包/類
@Override
public void handleMessage(Message msg) {
    switch (msg.what) {
        case PROCESS_DEFINITION_LIST:
            showSearchButton();
            List<Definition> definitionList = (List<Definition>) msg.obj;
            processDefinitionList(definitionList);
            break;
        case ASYNC_SEARCH_FAILED:
            showSearchButton();
            Toast.makeText(PopupActivity.this, (String) msg.obj, Toast.LENGTH_LONG).show();
            break;
        case SET_ADDED:
            progressDialog.hide();
            ImageButton btn = (ImageButton) msg.obj;
            btn.setBackgroundResource(R.drawable.ic_add_grey);
            btn.setEnabled(false);
            Toast.makeText(PopupActivity.this, R.string.term_added, Toast.LENGTH_SHORT).show();
            break;
        case SET_ADD_FAILED:
            progressDialog.hide();
            String message = (String) msg.obj;
            Toast.makeText(PopupActivity.this, message, Toast.LENGTH_SHORT).show();
            break;
        default:
            break;
    }
}
 
開發者ID:mmjang,項目名稱:quiz_helper,代碼行數:29,代碼來源:PopupActivity.java

示例7: onCreateView

import android.widget.ImageButton; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_playback_controls, container, false);

    mPlayPause = (ImageButton) rootView.findViewById(R.id.play_pause);
    mPlayPause.setEnabled(true);
    mPlayPause.setOnClickListener(mButtonListener);
    audioSeekBar = (SeekBar) rootView.findViewById(R.id.seekBar);
   
    mTitle = (TextView) rootView.findViewById(R.id.title);
    mSubtitle = (TextView) rootView.findViewById(R.id.artist);
    mExtraInfo = (TextView) rootView.findViewById(R.id.extra_info);
    mAlbumArt = (ImageView) rootView.findViewById(R.id.album_art);
    init();

    rootView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            List<MusicMedia> songList = MediaUtil.getInstacen().getSongList();
            Log.i(TAG,"songList="+songList.size());
            if(songList.size()>0){
                Intent playIntent = new Intent(getActivity(), FullScreenPlayerActivity.class);
                playIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
                if(MediaUtil.CURRENTPOS<0){
                    Toast.makeText(getActivity(),R.string.select_yinpin,0).show();
                    return;
                }
                playIntent.putExtra("music",songList.get(MediaUtil.CURRENTPOS));
                startActivity(playIntent);
            }else{
                Toast.makeText(getActivity(),R.string.select_yinpin,0).show();
            }


            //                playIntent.putExtra("position", position);
        }
    });
    return rootView;
}
 
開發者ID:ceji-longquan,項目名稱:ceji_android,代碼行數:41,代碼來源:PlaybackControlsFragment.java

示例8: afterTextChanged

import android.widget.ImageButton; //導入方法依賴的package包/類
@Override
public void afterTextChanged(Editable s) {
    ImageButton btnSend = (ImageButton) findViewById(R.id.btnSendMsg);
    if(s.length() > 0) {
        btnSend.setEnabled(true);
    } else {
        btnSend.setEnabled(false);
    }
}
 
開發者ID:Thizizmyname,項目名稱:MyPlace,代碼行數:10,代碼來源:MessageActivity.java

示例9: getCurrentPage

import android.widget.ImageButton; //導入方法依賴的package包/類
public void getCurrentPage() {
    LinearLayout noServersError = (LinearLayout) findViewById(R.id.errorMessage_noEnabledServers);
    noServersError.setVisibility(View.GONE);
    KRFAM.log("MainActivity.java > getCurrentPage");
    TextView searchBox = (TextView) findViewById(R.id.search_editText);
    Switch searchAll = (Switch) findViewById(R.id.allFolders_Switch);
    ImageButton nextPButton = (ImageButton) findViewById(R.id.nextPage_Button);
    ImageButton prevPButton = (ImageButton) findViewById(R.id.prevPage_Button);
    TextView pageInfo = (TextView) findViewById(R.id.pageInfo_textView);
    int accountTotal = db.countAccounts(CURRENT_FOLDER, searchBox.getText().toString(), searchAll.isChecked());
    int pageTotal = (accountTotal - 1) / KRFAM.MAX_DISPLAY + 1;
    int displayTop = (1 + CURRENT_OFFSET + KRFAM.MAX_DISPLAY);
    if (displayTop >= accountTotal + 1) {
        displayTop = accountTotal + 1;
        nextPButton.setEnabled(false);
    } else {
        nextPButton.setEnabled(true);
    }
    if (CURRENT_OFFSET <= 0) {
        CURRENT_OFFSET = 0;
        prevPButton.setEnabled(false);
    } else {
        prevPButton.setEnabled(true);
    }
    pageInfo.setText("Page " + ((CURRENT_OFFSET / KRFAM.MAX_DISPLAY) + 1) + " of " + pageTotal + "\n" + (1 + CURRENT_OFFSET) + "- " + (displayTop - 1) + " of " + accountTotal);

    ACCOUNT_LIST_DATA = db.getAccounts(CURRENT_FOLDER, KRFAM.MAX_DISPLAY, CURRENT_OFFSET, KRFAM.SORT_BY, KRFAM.REVERSE_SORT, searchBox.getText().toString(), searchAll.isChecked());
    if (ACCOUNT_LIST_DATA == null) {
        noServersError.setVisibility(View.VISIBLE);
        if (CURRENT_FOLDER != -1) {
            changeFolder(-1);
        }
    } else {
        ACCOUNT_LIST_ADAPTER = new AccountListAdapter(MainActivity.this, R.layout.account_list, ACCOUNT_LIST_DATA);
        ACCOUNT_LIST.setAdapter(ACCOUNT_LIST_ADAPTER);
    }
}
 
開發者ID:iebb,項目名稱:Kasumi,代碼行數:38,代碼來源:MainActivity.java

示例10: buildBottomBarButton

import android.widget.ImageButton; //導入方法依賴的package包/類
/**
 * Builds an {@link ImageButton} from the data in this params. Generated buttons should be
 * placed on the bottom bar. The button's tag will be its id.
 * @param parent The parent that the inflated {@link ImageButton}.
 * @param listener {@link OnClickListener} that should be used with the button.
 * @return Parsed list of {@link CustomButtonParams}, which is empty if the input is invalid.
 */
ImageButton buildBottomBarButton(Context context, ViewGroup parent, OnClickListener listener) {
    if (mIsOnToolbar) return null;

    ImageButton button = (ImageButton) LayoutInflater.from(context)
            .inflate(R.layout.custom_tabs_bottombar_item, parent, false);
    button.setId(mId);
    button.setImageBitmap(mIcon);
    button.setContentDescription(mDescription);
    if (mPendingIntent == null) {
        button.setEnabled(false);
    } else {
        button.setOnClickListener(listener);
    }
    button.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View view) {
            final int screenWidth = view.getResources().getDisplayMetrics().widthPixels;
            final int screenHeight = view.getResources().getDisplayMetrics().heightPixels;
            final int[] screenPos = new int[2];
            view.getLocationOnScreen(screenPos);
            final int width = view.getWidth();

            Toast toast = Toast.makeText(
                    view.getContext(), view.getContentDescription(), Toast.LENGTH_SHORT);
            toast.setGravity(Gravity.BOTTOM | Gravity.END,
                    screenWidth - screenPos[0] - width / 2,
                    screenHeight - screenPos[1]);
            toast.show();
            return true;
        }
    });
    return button;
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:41,代碼來源:CustomButtonParams.java

示例11: setImageButtonEnabled

import android.widget.ImageButton; //導入方法依賴的package包/類
public static void setImageButtonEnabled(Context ctxt, boolean enabled, ImageButton item,
                                         int iconResId) {
    item.setEnabled(enabled);
    Drawable originalIcon = ctxt.getResources().getDrawable(iconResId);
    Drawable icon = enabled ? originalIcon : convertDrawableToGrayScale(originalIcon);
    item.setImageDrawable(icon);
}
 
開發者ID:fekracomputers,項目名稱:IslamicLibraryAndroid,代碼行數:8,代碼來源:Util.java

示例12: initGenderButton

import android.widget.ImageButton; //導入方法依賴的package包/類
private ImageButton initGenderButton(final String gender, int buttonId) {
    boolean selected = gender.equals(mSpecimen.gender);

    ImageButton button = (ImageButton) findViewById(buttonId);
    button.setEnabled(mEditMode);
    button.setSelected(selected);
    updateGenderIconFilter(button);
    button.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (v.isSelected()) {
                //Deselect existing
                deselectAllGenderButtons();

                mSpecimen.gender = null;
            } else {
                //Select this one
                deselectAllGenderButtons();
                v.setSelected(true);

                mSpecimen.gender = gender;
            }
            updateGenderIconFilter((ImageButton) v);
        }
    });
    return button;
}
 
開發者ID:suomenriistakeskus,項目名稱:oma-riista-android,代碼行數:28,代碼來源:SrvaSpecimenView.java

示例13: getView

import android.widget.ImageButton; //導入方法依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {

    Project project = mProjects.get(position);
    if(convertView == null) {
        LayoutInflater inflater = LayoutInflater.from(MBApp.getApp());
        convertView = inflater.inflate(R.layout.project_items, null);
    }

    Button appNameButton = (Button) convertView.findViewById(R.id.appNameButton);
    appNameButton.setTypeface(MBApp.getApp().getRobotoTypeface());

    ExtendedEditText appNameEdit = (ExtendedEditText) convertView.findViewById(R.id.appNameEdit);
    appNameEdit.setTypeface(MBApp.getApp().getRobotoTypeface());

    LinearLayout actionBarLayout = (LinearLayout) convertView.findViewById(R.id.actionBarForProgram);
    if(actionBarLayout != null) {
        if(project.actionBarExpanded) {
            actionBarLayout.setVisibility(View.VISIBLE);
            appNameButton.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(MBApp.getApp()
                    , R.drawable.ic_arrow_down), null);
        } else {
            actionBarLayout.setVisibility(View.GONE);
            appNameButton.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(MBApp.getApp()
                    , R.drawable.ic_arrow_left), null);
        }
    }

    appNameButton.setText(project.name);
    appNameButton.setTag(R.id.positionId, position);
    appNameButton.setTag(R.id.textEdit, appNameEdit);
    appNameButton.setOnClickListener(appNameClickListener);
    appNameButton.setOnLongClickListener(appNameLongClickListener);

    appNameEdit.setTag(R.id.positionId, position);
    appNameEdit.setTag(R.id.editbutton, appNameButton);
    appNameEdit.setOnEditorActionListener(editorOnActionListener);
    appNameEdit.setFilters(new InputFilter[]{renameFilter});

    if(project.inEditMode) {
        appNameEdit.setVisibility(View.VISIBLE);

        appNameEdit.setText(project.name);
        appNameEdit.setSelection(project.name.length());
        appNameEdit.requestFocus();
        appNameButton.setVisibility(View.INVISIBLE);

    } else {
        appNameEdit.setVisibility(View.INVISIBLE);
        appNameButton.setVisibility(View.VISIBLE);
        //dismissKeyBoard(appNameEdit, false);
    }

    //appNameEdit.setOnClickListener(appNameClickListener);

    TextView flashBtnText = (TextView) convertView.findViewById(R.id.project_item_text);
    flashBtnText.setTypeface(MBApp.getApp().getRobotoTypeface());
    LinearLayout sendBtnLayout = (LinearLayout) convertView.findViewById(R.id.sendBtn);
    sendBtnLayout.setTag(position);
    sendBtnLayout.setOnClickListener(sendBtnClickListener);

    ImageButton deleteBtn = (ImageButton) convertView.findViewById(R.id.deleteBtn);
    deleteBtn.setTag(position);
    deleteBtn.setOnClickListener(deleteBtnClickListener);
    deleteBtn.setEnabled(true);


    Drawable myIcon;
    if(project.runStatus) {
        flashBtnText.setText("");
        myIcon = convertView.getResources().getDrawable(R.drawable.green_btn);
    } else {
        flashBtnText.setText(R.string.flash);
        myIcon = convertView.getResources().getDrawable(R.drawable.blue_btn);
    }
    sendBtnLayout.setBackground(myIcon);

    sendBtnLayout.setClickable(true);
    return convertView;
}
 
開發者ID:Samsung,項目名稱:microbit,代碼行數:81,代碼來源:ProjectAdapter.java

示例14: setButtonEnabled

import android.widget.ImageButton; //導入方法依賴的package包/類
private void setButtonEnabled(ImageButton button, boolean enabled) {
	button.setEnabled(enabled);
	button.setColorFilter(enabled ? Color.argb(255, 255, 255, 255) : Color.argb(255, 128, 128, 128));
}
 
開發者ID:ArtifexSoftware,項目名稱:mupdf-android-viewer-old,代碼行數:5,代碼來源:MuPDFActivity.java

示例15: setButtonEnabled

import android.widget.ImageButton; //導入方法依賴的package包/類
protected void setButtonEnabled(ImageButton b, boolean isEnabled)
{
    b.setEnabled(isEnabled);
    ViewUtils.setImageButtonColorAttr(getContext(), b,
            b.isEnabled() ? R.attr.colorDialogContent : R.attr.colorDialogDisabledElement);
}
 
開發者ID:mkulesh,項目名稱:microMathematics,代碼行數:7,代碼來源:DialogBase.java


注:本文中的android.widget.ImageButton.setEnabled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。