android.view.View#setEnabled ( )源码实例Demo

下面列出了android.view.View#setEnabled ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: FimiX8-RE   文件: X8FcExpSettingController.java
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);
                    }
                }
            }
        }
    }
}
 
源代码2 项目: TelePlus-Android   文件: AndroidUtilities.java
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);
        }
    }
}
 
源代码3 项目: PowerFileExplorer   文件: ABaseTransformer.java
/**
 * 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);
	}
}
 
源代码4 项目: PracticeCode   文件: RegisterActivity.java
private void backViewAnimation(View oldView) {
    oldView.startAnimation(FlyBackAnimation);
    waitBar.startAnimation(FadeOutAnimation);
    waitBar.setAlpha(0);
    waitBar.setVisibility(View.GONE);
    oldView.setEnabled(true);
}
 
源代码5 项目: ScreenShift   文件: MainActivity.java
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);
            }
        }*/
    }
}
 
源代码6 项目: aard2-android   文件: DictionaryListAdapter.java
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);
}
 
源代码7 项目: YalpStore   文件: ButtonCancel.java
@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);
}
 
源代码8 项目: onpc   文件: Utils.java
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));
    }
}
 
源代码9 项目: dhis2-android-datacapture   文件: ViewUtils.java
public static void disableViews(View... views) {
	for (View view : views) {
           if (view != null) {
               view.setEnabled(false);
               view.setVisibility(View.INVISIBLE);
           }
	}
}
 
源代码10 项目: matrix-android-console   文件: SettingsActivity.java
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);
}
 
源代码11 项目: dhis2-android-datacapture   文件: ViewUtils.java
public static void enableViews(View... views) {
    for (View view : views) {
        if (view != null) {
            view.setEnabled(true);
            view.setVisibility(View.VISIBLE);
        }
    }
}
 
源代码12 项目: arcusandroid   文件: PicListDataAdapter.java
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;
}
 
源代码13 项目: AndroidPNClient   文件: MainActivity.java
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;
    }
}
 
@Override
public void onClick(View view) {
    switch (view.getId()) {
        case R.id.button_quit:
            view.setEnabled(false);
            System.exit(0);
    }
}
 
源代码15 项目: YiBo   文件: MyHomeRefreshClickListener.java
@Override
public void onClick(View v) {
	v.setEnabled(false);
	
       MyHomePageUpTask task = new MyHomePageUpTask(adapter);
       task.execute();
}
 
private void disableBottomButtonNavigation(View button) {
    button.setAlpha(style.alphaOfDisabledElements);
    button.setEnabled(false);
}
 
@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()));
    }
}
 
源代码18 项目: YiBo   文件: EditCommentSendClickListener.java
@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();
    }
}
 
@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;
}
 
源代码20 项目: smart-farmer-android   文件: ViewUtil.java
public static void setEnable(boolean enable, View view){
    if (view != null){
        view.setEnabled(enable);
    }
}
 
 方法所在类
 同类方法