Java Code Examples for android.view.View#setEnabled()
The following examples show how to use
android.view.View#setEnabled() .
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: X8FcExpSettingController.java From FimiX8-RE with MIT License | 6 votes |
public void updateViewEnable(boolean enable, ViewGroup... parent) { if (parent != null && parent.length > 0) { for (ViewGroup group : parent) { int len = group.getChildCount(); for (int j = 0; j < len; j++) { View subView = group.getChildAt(j); if (subView instanceof ViewGroup) { updateViewEnable(enable, (ViewGroup) subView); } else { if (subView instanceof X8FixedEditText) { subView.setEnabled(false); } else { subView.setEnabled(enable); } if (enable) { subView.setAlpha(1.0f); } else { subView.setAlpha(0.6f); } } } } } }
Example 2
Source File: AndroidUtilities.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public static void setEnabled(View view, boolean enabled) { if (view == null) { return; } view.setEnabled(enabled); if (view instanceof ViewGroup) { ViewGroup viewGroup = (ViewGroup) view; for (int i = 0; i < viewGroup.getChildCount(); i++) { setEnabled(viewGroup.getChildAt(i), enabled); } } }
Example 3
Source File: ABaseTransformer.java From PowerFileExplorer with GNU General Public License v3.0 | 6 votes |
/** * Called each {@link #transformPage(android.view.View, float)} before {{@link #onTransform(android.view.View, float)}. * <p> * The default implementation attempts to reset all view properties. This is useful when toggling transforms that do * not modify the same page properties. For instance changing from a transformation that applies rotation to a * transformation that fades can inadvertently leave a fragment stuck with a rotation or with some degree of applied * alpha. * * @param page * Apply the transformation to this page * @param position * Position of page relative to the current front-and-center position of the pager. 0 is front and * center. 1 is one full page position to the right, and -1 is one page position to the left. */ protected void onPreTransform(View page, float position) { final float width = page.getWidth(); page.setRotationX(0); page.setRotationY(0); page.setRotation(0); page.setScaleX(1); page.setScaleY(1); page.setPivotX(0); page.setPivotY(0); page.setTranslationY(0); page.setTranslationX(isPagingEnabled() ? 0f : -width * position); if (hideOffscreenPages()) { page.setAlpha(position <= -1f || position >= 1f ? 0f : 1f); page.setEnabled(false); } else { page.setEnabled(true); page.setAlpha(1f); } }
Example 4
Source File: MainActivity.java From ScreenShift with Apache License 2.0 | 5 votes |
private void setViewEnabled(boolean enabled, View... views) { for(View view: views) { view.setEnabled(enabled); /*if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB*//* && !(view instanceof SeekBar)*//*) { if(enabled) { view.setAlpha(ENABLED_ALPHA); } else { view.setAlpha(DISABLED_ALPHA); } }*/ } }
Example 5
Source File: DictionaryListAdapter.java From aard2-android with GNU General Public License v3.0 | 5 votes |
private void setupCopyrightView(SlobDescriptor desc, boolean available, View view) { View copyrightRow= view.findViewById(R.id.dictionary_copyright_row); ImageView copyrightIcon = (ImageView) view.findViewById(R.id.dictionary_copyright_icon); copyrightIcon.setImageDrawable(IconMaker.text(context, IconMaker.IC_COPYRIGHT)); TextView copyrightView = (TextView) view.findViewById(R.id.dictionary_copyright); String copyright = desc.tags.get("copyright"); copyrightView.setText(copyright); copyrightRow.setVisibility(Util.isBlank(copyright) ? View.GONE : View.VISIBLE); copyrightRow.setEnabled(available); }
Example 6
Source File: ButtonCancel.java From YalpStore with GNU General Public License v2.0 | 5 votes |
@Override protected void onButtonClick(View button) { new DownloadManager(activity).cancel(app.getPackageName()); button.setVisibility(View.GONE); View buttonDownload = activity.findViewById(R.id.download); if (buttonDownload instanceof android.widget.Button) { ((android.widget.Button) buttonDownload).setText(R.string.details_download); } buttonDownload.setEnabled(true); }
Example 7
Source File: RegisterActivity.java From PracticeCode with Apache License 2.0 | 5 votes |
private void backViewAnimation(View oldView) { oldView.startAnimation(FlyBackAnimation); waitBar.startAnimation(FadeOutAnimation); waitBar.setAlpha(0); waitBar.setVisibility(View.GONE); oldView.setEnabled(true); }
Example 8
Source File: Utils.java From onpc with GNU General Public License v3.0 | 5 votes |
public static void setButtonEnabled(Context context, View b, boolean isEnabled) { @AttrRes int resId = isEnabled ? R.attr.colorButtonEnabled : R.attr.colorButtonDisabled; b.setEnabled(isEnabled); if (b instanceof AppCompatImageButton) { Utils.setImageButtonColorAttr(context, (AppCompatImageButton) b, resId); } if (b instanceof AppCompatButton) { ((AppCompatButton) b).setTextColor(Utils.getThemeColorAttr(context, resId)); } }
Example 9
Source File: ViewUtils.java From dhis2-android-datacapture with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static void disableViews(View... views) { for (View view : views) { if (view != null) { view.setEnabled(false); view.setVisibility(View.INVISIBLE); } } }
Example 10
Source File: SettingsActivity.java From matrix-android-console with Apache License 2.0 | 5 votes |
private void refreshGCMEntries() { GcmRegistrationManager gcmRegistrationManager = Matrix.getInstance(this).getSharedGcmRegistrationManager(); final CheckBox gcmBox = (CheckBox) findViewById(R.id.checkbox_useGcm); gcmBox.setChecked(gcmRegistrationManager.useGCM() && gcmRegistrationManager.is3rdPartyServerRegistred()); // check if the GCM registration has not been rejected. boolean gcmButEnabled = gcmRegistrationManager.useGCM() || gcmRegistrationManager.isGCMRegistred(); View parentView = (View)gcmBox.getParent(); parentView.setEnabled(gcmButEnabled); gcmBox.setEnabled(gcmButEnabled); parentView.setAlpha(gcmButEnabled ? 1.0f : 0.5f); }
Example 11
Source File: MyHomeRefreshClickListener.java From YiBo with Apache License 2.0 | 5 votes |
@Override public void onClick(View v) { v.setEnabled(false); MyHomePageUpTask task = new MyHomePageUpTask(adapter); task.execute(); }
Example 12
Source File: ViewUtils.java From dhis2-android-datacapture with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static void enableViews(View... views) { for (View view : views) { if (view != null) { view.setEnabled(true); view.setVisibility(View.VISIBLE); } } }
Example 13
Source File: PicListDataAdapter.java From arcusandroid with Apache License 2.0 | 5 votes |
private View getViewForBlurb(String daBlurb, View view) { TextView daBlurbTV = (TextView) view.findViewById(R.id.home_away_blurb_tv); daBlurbTV.setText(String.valueOf(daBlurb)); view.setEnabled(false); return view; }
Example 14
Source File: AboutFragmentOnClickListener.java From android-crackme-challenge with MIT License | 5 votes |
@Override public void onClick(View view) { switch (view.getId()) { case R.id.button_quit: view.setEnabled(false); System.exit(0); } }
Example 15
Source File: MainActivity.java From AndroidPNClient with Apache License 2.0 | 5 votes |
public void onClick(View v) { switch (v.getId()) { case R.id.bt_notify_all_msgs: startActivity(new Intent(this, NotifyListActivity.class)); break; case R.id.bt_login: BroadcastUtil.sendBroadcast(this, BroadcastUtil.APN_ACTION_RECONNECT); v.setEnabled(false); default: break; } }
Example 16
Source File: ViewUtil.java From smart-farmer-android with Apache License 2.0 | 4 votes |
public static void setEnable(boolean enable, View view){ if (view != null){ view.setEnabled(enable); } }
Example 17
Source File: WallPaperGridViewAdapter.java From AndroidTranslucentUI with Apache License 2.0 | 4 votes |
@Override public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder viewHolder = null; if (convertView == null) { convertView = LayoutInflater.from(context).inflate(R.layout.item_change_wallpaper, null); viewHolder = new ViewHolder(); viewHolder.wallpaperImageView = (ImageView)convertView.findViewById(R.id.wallpaper_imageview); viewHolder.wallpaperView = (View)convertView.findViewById(R.id.wallpaper_view); convertView.setTag(viewHolder); }else viewHolder = (ViewHolder) convertView.getTag(); /*####################�� ����ֹ�������#########################*/ //����취����ѹ�� //ѹ�������ڽ�ʡBITMAP�ڴ�ռ�--���BUG�Ĺؼ����� /*BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inSampleSize = 4; //�����ֵѹ���ı�����2��������������ֵԽС��ѹ����ԽС��ͼƬԽ���� //����ԭͼ����֮���bitmap���� currentBitmap = BitmapFactory.decodeResource(context.getResources(), picIds[position], opts);*/ if(position == 8){ convertView.setEnabled(false); } currentBitmap = ThumbnailUtils.extractThumbnail(BitmapFactory.decodeResource(context.getResources(), picIds[position]), 130, 180); viewHolder.wallpaperImageView.setImageBitmap(currentBitmap); if(position == selectPosition){ viewHolder.wallpaperView.setBackgroundColor(context.getResources().getColor(R.color.trans_light_green)); }else{ viewHolder.wallpaperView.setBackgroundColor(Color.TRANSPARENT); } convertView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { setSelectedPosition(position); notifyDataSetChanged(); } }); return convertView; }
Example 18
Source File: EditCommentSendClickListener.java From YiBo with Apache License 2.0 | 4 votes |
@Override public void onClick(View v) { EditText etComment = (EditText) context.findViewById(R.id.etText); String text = etComment.getText().toString().trim(); if (StringUtil.isEmpty(text) && etComment.getHint() != null) { text = etComment.getHint().toString(); } if (StringUtil.isEmpty(text)) { Toast.makeText(v.getContext(), R.string.msg_comment_empty, Toast.LENGTH_LONG).show(); return; } int byteLen = StringUtil.getLengthByByte(text); if (byteLen > Constants.STATUS_TEXT_MAX_LENGTH * 2) { text = StringUtil.subStringByByte(text, 0, Constants.STATUS_TEXT_MAX_LENGTH * 2); } v.setEnabled(false); context.getEmotionViewController().hideEmotionView(); context.displayOptions(true); //hide input method InputMethodManager inputMethodManager = (InputMethodManager)v.getContext(). getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(etComment.getWindowToken(), 0); UpdateCommentTask commentTask = null; Comment recomment = context.getRecomment(); if (recomment == null) { commentTask = new UpdateCommentTask(context, text, context.getStatus().getStatusId(), account); } else { //String recommentText = text.substring(text.indexOf(":") + 1); //截断评论前的hint String recommentText = text; if (account.getServiceProvider() == ServiceProvider.Sohu) { recommentText = text; } if (StringUtil.isEmpty(recommentText)) { Toast.makeText(context, R.string.msg_comment_empty, Toast.LENGTH_LONG).show(); v.setEnabled(true); return; } commentTask = new UpdateCommentTask( v.getContext(), recommentText, context.getStatus().getStatusId(), recomment.getCommentId(), account ); } commentTask.setShowDialog(true); commentTask.execute(); if (context.isRetweet()) { String retweetText = text; if (context.getRecomment() != null) { retweetText += " //" + context.getRecomment().getUser().getMentionName() + ":" + context.getRecomment().getText(); } if (context.getStatus().getRetweetedStatus() != null) { retweetText += " //" + context.getStatus().getUser().getMentionName() + ":" + context.getStatus().getText(); } byteLen = StringUtil.getLengthByByte(retweetText); if (byteLen > Constants.STATUS_TEXT_MAX_LENGTH * 2) { retweetText = StringUtil.subStringByByte(retweetText, 0, Constants.STATUS_TEXT_MAX_LENGTH * 2); } RetweetTask retweetTask = new RetweetTask( context, context.getStatus().getStatusId(), retweetText, account ); retweetTask.setShowDialog(false); retweetTask.execute(); } if (context.isCommentToOrigin()) { String ctoText = text + " #" + context.getString(R.string.app_name) + "#"; Status retweetedStatus = context.getStatus().getRetweetedStatus(); UpdateCommentTask commenToOriginTask = new UpdateCommentTask( context, ctoText, retweetedStatus.getStatusId(), account ); commenToOriginTask.setShowDialog(false); commenToOriginTask.execute(); } }
Example 19
Source File: DecorationListFragment.java From MonsterHunter4UDatabase with MIT License | 4 votes |
@Override public void bindView(View view, Context context, Cursor cursor) { // Get the decoration for the current row Decoration decoration = mDecorationCursor.getDecoration(); RelativeLayout itemLayout = (RelativeLayout) view.findViewById(R.id.listitem); // Set up the text view ImageView itemImageView = (ImageView) view.findViewById(R.id.item_image); TextView decorationNameTextView = (TextView) view.findViewById(R.id.item); TextView skill1TextView = (TextView) view.findViewById(R.id.skill1); TextView skill1amtTextView = (TextView) view.findViewById(R.id.skill1_amt); TextView skill2TextView = (TextView) view.findViewById(R.id.skill2); TextView skill2amtTextView = (TextView) view.findViewById(R.id.skill2_amt); String decorationNameText = decoration.getName(); String skill1Text = decoration.getSkill1Name(); String skill1amtText = "" + decoration.getSkill1Point(); String skill2Text = decoration.getSkill2Name(); String skill2amtText = ""; if (decoration.getSkill2Point() != 0) { skill2amtText = skill2amtText + decoration.getSkill2Point(); } Drawable i = null; String cellImage = "icons_items/" + decoration.getFileLocation(); try { i = Drawable.createFromStream( context.getAssets().open(cellImage), null); } catch (IOException e) { e.printStackTrace(); } itemImageView.setImageDrawable(i); decorationNameTextView.setText(decorationNameText); skill1TextView.setText(skill1Text); skill1amtTextView.setText(skill1amtText); skill2TextView.setVisibility(View.GONE); skill2amtTextView.setVisibility(View.GONE); if (!skill2amtText.equals("")) { skill2TextView.setText(skill2Text); skill2amtTextView.setText(skill2amtText); skill2TextView.setVisibility(View.VISIBLE); skill2amtTextView.setVisibility(View.VISIBLE); } itemLayout.setTag(decoration.getId()); if (fromAsb) { boolean fitsInArmor = (decoration.getNumSlots() <= maxSlots); view.setEnabled(fitsInArmor); // Set the jewel image to be translucent if disabled // TODO: If a way to use alpha with style selectors exist, use that instead itemImageView.setAlpha((fitsInArmor) ? 1.0f : 0.5f); if (fitsInArmor) { itemLayout.setOnClickListener(new DecorationClickListener(context, decoration.getId(), true, activity)); } } else { itemLayout.setOnClickListener(new DecorationClickListener(context, decoration.getId())); } }
Example 20
Source File: VerticalStepperFormView.java From VerticalStepperForm with Apache License 2.0 | 4 votes |
private void disableBottomButtonNavigation(View button) { button.setAlpha(style.alphaOfDisabledElements); button.setEnabled(false); }