private void onConnected() { mConsoleInput.setEnabled(true); }
@Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); }
private int deleteLastTypedKey() { int deleted = mTypedTimes.remove(mTypedTimes.size() - 1); if (!isTypedTimeFullyLegal()) { mDoneButton.setEnabled(false); } return deleted; }
/** * 处理 VideoEvent,来改变编辑状态UI * * @param videoEvent */ private void _handleVideoEvent(VideoEvent videoEvent) { mBtnSelectDel.setEnabled(videoEvent.checkStatus != VideoEvent.CHECK_NONE); mBtnSelectAll.setText(videoEvent.checkStatus == VideoEvent.CHECK_ALL ? "取消全选" : "全选"); mBtnSelectAll.setSelected(videoEvent.checkStatus == VideoEvent.CHECK_ALL); }
private int deleteLastTypedKey() { int deleted = mTypedTimes.remove(mTypedTimes.size() - 1); if (!isTypedTimeFullyLegal()) { mDoneButton.setEnabled(false); } return deleted; }
private void toggleControls(boolean sending) { if (isFinishing()) { return; } mSending = sending; mTitleEditText.setEnabled(!sending); mContentEditText.setEnabled(!sending); supportInvalidateOptionsMenu(); }
private void updateBottomToolbar() { int selectedCount = mSelectedCollection.count(); if (selectedCount == 0) { mButtonPreview.setEnabled(false); mButtonApply.setEnabled(false); mButtonApply.setText(getString(R.string.button_sure_default)); } else if (selectedCount == 1 && mSpec.singleSelectionModeEnabled()) { mButtonPreview.setEnabled(true); mButtonApply.setText(R.string.button_sure_default); mButtonApply.setEnabled(true); } else { mButtonPreview.setEnabled(true); mButtonApply.setEnabled(true); mButtonApply.setText(getString(R.string.button_sure, selectedCount)); } if (mSpec.originalable) { mOriginalLayout.setVisibility(View.VISIBLE); updateOriginalState(); } else { mOriginalLayout.setVisibility(View.INVISIBLE); } }
private void updateApplyButton() { int selectedCount = mSelectedCollection.count(); if (selectedCount == 0) { mButtonApply.setText(R.string.button_sure_default); mButtonApply.setEnabled(false); } else if (selectedCount == 1 && mSpec.singleSelectionModeEnabled()) { mButtonApply.setText(R.string.button_sure_default); mButtonApply.setEnabled(true); } else { mButtonApply.setEnabled(true); mButtonApply.setText(getString(R.string.button_sure, selectedCount)); } if (mSpec.originalable) { mOriginalLayout.setVisibility(View.VISIBLE); updateOriginalState(); } else { mOriginalLayout.setVisibility(View.GONE); } }
private void enableButtons() { announceButton.setEnabled(true); shareButton.setEnabled(true); messageButton.setEnabled(true); }
private void disableButtons() { announceButton.setEnabled(false); shareButton.setEnabled(false); messageButton.setEnabled(false); }
private void initSearchHistory() { List<String> list = CacheManager.getInstance().getSearchHistory(); mHisAdapter.clear(); if (list != null && list.size() > 0) { tvClear.setEnabled(true); mHisAdapter.addAll(list); } else { tvClear.setEnabled(false); } mHisAdapter.notifyDataSetChanged(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.irc_chat_activity); mConsoleDisplay = (ListView) findViewById(R.id.console_display); mConsoleRowAdapter = new IRCConsoleRowAdapter(this); mConsoleDisplay.setAdapter(mConsoleRowAdapter); mConsoleInput = (TextView) findViewById(R.id.console_input); mConsoleInput.setOnEditorActionListener(mOnConsoleInputEditorAction); findViewById(R.id.console_send).setOnClickListener(mConsoleSendClicked); // Will re-enable once we connect... mConsoleInput.setEnabled(false); mSimpleIRCConnectionManager = new SimpleIRCConnectionManager( getIntent().getStringExtra(EXTRA_HOST_AND_MAYBE_PORT), getIntent().getStringExtra(EXTRA_NICKNAME)); mConnectionExecutor = Executors.newCachedThreadPool(); mConnectionExecutor.execute(new Runnable() { @Override public void run() { mSimpleIRCConnectionManager.runConnectLoop(); } }); }
private boolean addKeyIfLegal(int keyCode) { // If we're in 24hour mode, we'll need to check if the input is full. If in AM/PM mode, // we'll need to see if AM/PM have been typed. if ((mIs24HourMode && mTypedTimes.size() == 4) || (!mIs24HourMode && isTypedTimeFullyLegal())) { return false; } mTypedTimes.add(keyCode); if (!isTypedTimeLegalSoFar()) { deleteLastTypedKey(); return false; } int val = getValFromKeyCode(keyCode); Utils.tryAccessibilityAnnounce(mTimePicker, String.format("%d", val)); // Automatically fill in 0's if AM or PM was legally entered. if (isTypedTimeFullyLegal()) { if (!mIs24HourMode && mTypedTimes.size() <= 3) { mTypedTimes.add(mTypedTimes.size() - 1, KeyEvent.KEYCODE_0); mTypedTimes.add(mTypedTimes.size() - 1, KeyEvent.KEYCODE_0); } mDoneButton.setEnabled(true); } return true; }
@SuppressLint("StringFormatMatches") @Override public void onImageSelected(int position, ImageItem item, boolean isAdd) { if (imagePicker.getSelectImageCount() > 0) { mBtnOk.setText(getString(R.string.ip_select_complete, imagePicker.getSelectImageCount(), imagePicker.getSelectLimit())); mBtnOk.setEnabled(true); mBtnPre.setEnabled(true); mBtnPre.setText(getResources().getString(R.string.ip_preview_count, imagePicker.getSelectImageCount())); mBtnPre.setTextColor(ContextCompat.getColor(this, R.color.ip_text_primary_inverted)); mBtnOk.setTextColor(ContextCompat.getColor(this, R.color.ip_text_primary_inverted)); } else { mBtnOk.setText(getString(R.string.ip_complete)); mBtnOk.setEnabled(false); mBtnPre.setEnabled(false); mBtnPre.setText(getResources().getString(R.string.ip_preview)); mBtnPre.setTextColor(ContextCompat.getColor(this, R.color.ip_text_secondary_inverted)); mBtnOk.setTextColor(ContextCompat.getColor(this, R.color.ip_text_secondary_inverted)); } // mImageGridAdapter.notifyDataSetChanged(); // mRecyclerAdapter.notifyItemChanged(position); // 17/4/21 fix the position while click img to preview // mRecyclerAdapter.notifyItemChanged(position + (imagePicker.isShowCamera() ? 1 : 0));// 17/4/24 fix the position while click right bottom preview button for (int i = imagePicker.isShowCamera() ? 1 : 0; i < mRecyclerAdapter.getItemCount(); i++) { if (mRecyclerAdapter.getItem(i).path != null && mRecyclerAdapter.getItem(i).path.equals(item.path)) { mRecyclerAdapter.notifyItemChanged(i); return; } } }
private boolean addKeyIfLegal(int keyCode) { // If we're in 24hour mode, we'll need to check if the input is full. If in AM/PM mode, // we'll need to see if AM/PM have been typed. if ((mIs24HourMode && mTypedTimes.size() == 4) || (!mIs24HourMode && isTypedTimeFullyLegal())) { return false; } mTypedTimes.add(keyCode); if (!isTypedTimeLegalSoFar()) { deleteLastTypedKey(); return false; } int val = getValFromKeyCode(keyCode); Utils.tryAccessibilityAnnounce(mTimePicker, String.format("%d", val)); // Automatically fill in 0's if AM or PM was legally entered. if (isTypedTimeFullyLegal()) { if (!mIs24HourMode && mTypedTimes.size() <= 3) { mTypedTimes.add(mTypedTimes.size() - 1, KeyEvent.KEYCODE_0); mTypedTimes.add(mTypedTimes.size() - 1, KeyEvent.KEYCODE_0); } mDoneButton.setEnabled(true); } return true; }
/** * Try to start keyboard mode with the specified key, as long as the timepicker is not in the * middle of a touch-event. * @param keyCode The key to use as the first press. Keyboard mode will not be started if the * key is not legal to start with. Or, pass in -1 to get into keyboard mode without a starting * key. */ private void tryStartingKbMode(int keyCode) { if (mTimePicker.trySettingInputEnabled(false) && (keyCode == -1 || addKeyIfLegal(keyCode))) { mInKbMode = true; mDoneButton.setEnabled(false); updateDisplay(false); } }
/** * Try to start keyboard mode with the specified key, as long as the timepicker is not in the * middle of a touch-event. * * @param keyCode The key to use as the first press. Keyboard mode will not be started if the * key is not legal to start with. Or, pass in -1 to get into keyboard mode without a starting * key. */ private void tryStartingKbMode(int keyCode) { if (mTimePicker.trySettingInputEnabled(false) && (keyCode == -1 || addKeyIfLegal(keyCode))) { mInKbMode = true; mDoneButton.setEnabled(false); updateDisplay(false); } }
mDoneButton.setEnabled(true); } else { Boolean[] enteredZeros = {false, false};
mDoneButton.setEnabled(true); } else { Boolean[] enteredZeros = {false, false};
childView.setEnabled(false); childView.setId(clickableChildCounter++); childView.setText(text.replaceFirst(REPLACE_REGEX_DISABLED, ""));