/** */ @Override public void clearError() { if (mError != null) { this.mError = null; mWidget.refreshDrawableState(); mWidget.invalidate(); } }
/** */ @Override public void clearError() { if (mError != null) { this.mError = null; mWidget.refreshDrawableState(); mWidget.invalidate(); } }
/** */ @Override public void setError(@NonNull CharSequence error) { if (!TextUtils.equals(mError, error)) { this.mError = error; mWidget.refreshDrawableState(); mWidget.invalidate(); } }
View content = findViewById(R.id.myElementForScreenshoot); View screenshot = content; // or content.getRootView() for fullscreen screenshot.refreshDrawableState(); screenshot.setDrawingCacheEnabled(true); Bitmap b = screenshot.getDrawingCache();
/** */ @Override public void setError(@NonNull CharSequence error) { if (!TextUtils.equals(mError, error)) { this.mError = error; mWidget.refreshDrawableState(); mWidget.invalidate(); } }
class myMediaController extends MediaController{ private View anchorView = null; //this ref to videoview from setAnchorView(View view) public myMediaController(Context context, boolean useFastForward) { super(context, useFastForward); } @Override public void setAnchorView(View view) { super.setAnchorView(view); anchorView = view; } @Override public void hide() { super.hide(); anchorView.invalidate(); //refresh with and height of video view on screen anchorView.refreshDrawableState(); } }
public Bitmap getBitmapFromView(View view){ view.setDrawingCacheEnabled(true); view.refreshDrawableState(); Bitmap bitmap = view.getDrawingCache(); view.setDrawingCacheEnabled(false); return bitmap; }
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.rowlayout, parent, false); if ((position % 2) == 0) { rowView.setBackgroundResource(R.drawable.trapeze_down); } else { rowView.setBackgroundResource(R.drawable.trapeze_up); } rowView.refreshDrawableState(); return rowView; }
@Override public void refreshDrawableState() { super.refreshDrawableState(); if (isPressed()) { ObjectAnimator fadeIn = ObjectAnimator.ofFloat( this, "alpha", ALPHA_NORMAL_STATE, ALPHA_PRESSED_STATE); fadeIn.setDuration(FADE_DURATION_IN_MILLI); fadeIn.setInterpolator(new DecelerateInterpolator()); fadeIn.start(); } else { ObjectAnimator fadeOut = ObjectAnimator.ofFloat( this, "alpha", ALPHA_PRESSED_STATE, ALPHA_NORMAL_STATE); fadeOut.setDuration(FADE_DURATION_IN_MILLI); fadeOut.setInterpolator(new DecelerateInterpolator()); fadeOut.start(); } }
protected void launchLicense() { License license = new License(this); View mLicense = license.getView(); mLicense.refreshDrawableState(); new AlertDialog.Builder(Settings.this) .setTitle(R.string.license_title) .setIcon(R.drawable.ic_logo) .setView(mLicense) .setPositiveButton(R.string.license_accept_button, null) .show(); }
static protected void launchContribute(Context context) { Contribute contribute = new Contribute(context); View mContribute = contribute.getView(); mContribute.refreshDrawableState(); new AlertDialog.Builder(context) .setTitle(R.string.contribute_title) .setIcon(R.drawable.ic_logo) .setView(mContribute) .setPositiveButton(R.string.contribute_accept_button, null) .show(); }
public void onClick(View v) { Log.i(TAG, "Starting thumbnail-zoom animation..."); // Create a thumbnail animation. We are going to build our thumbnail // just from the view that was pressed. We make sure the view is // not selected, because by the time the animation starts we will // have finished with the selection of the tap. v.setDrawingCacheEnabled(true); v.setPressed(false); v.refreshDrawableState(); Bitmap bm = v.getDrawingCache(); Canvas c = new Canvas(bm); //c.drawARGB(255, 255, 0, 0); ActivityOptions opts = ActivityOptions.makeThumbnailScaleUpAnimation( v, bm, 0, 0); // Request the activity be started, using the custom animation options. startActivity(new Intent(Animation.this, AlertDialogSamples.class), opts.toBundle()); v.setDrawingCacheEnabled(false); } };
public void onClick(View v) { // Create a thumbnail animation. We are going to build our thumbnail // just from the view that was pressed. We make sure the view is // not selected, because by the time the animation starts we will // have finished with the selection of the tap. v.setDrawingCacheEnabled(true); v.setPressed(false); v.refreshDrawableState(); Bitmap bm = v.getDrawingCache(); Canvas c = new Canvas(bm); //c.drawARGB(255, 255, 0, 0); ActivityOptions opts = ActivityOptions.makeThumbnailScaleUpAnimation( v, bm, 0, 0); // Request the activity be started, using the custom animation options. startActivity(new Intent(Animation.this, AlertDialogSamples.class), opts.toBundle()); v.setDrawingCacheEnabled(false); } };
@TargetApi(21) static protected void launchUsPermission(Context context) { UsPermission usPermission = new UsPermission(context); View mUsPermission = usPermission.getView(); mUsPermission.refreshDrawableState(); new AlertDialog.Builder(context) .setTitle(R.string.us_permission_title) .setIcon(R.drawable.ic_logo) .setView(mUsPermission) .setPositiveButton(R.string.us_permission_settings_button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mContext.startActivity(new Intent( android.provider.Settings.ACTION_USAGE_ACCESS_SETTINGS)); } }) .setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { mContext.startActivity(new Intent( android.provider.Settings.ACTION_USAGE_ACCESS_SETTINGS)); } }) .show(); }
protected void launchDonate() { final Donate donate = new Donate(this); donate.bindServiceConn(); View mDonate = donate.getView(mContext); mDonate.refreshDrawableState(); AlertDialog.Builder builder = new AlertDialog.Builder(Settings.this) .setTitle(R.string.donate_title) .setIcon(R.drawable.ic_logo) .setView(mDonate) .setPositiveButton(R.string.donate_accept_button, null); AlertDialog alert = builder.show(); alert.setOnDismissListener(new AlertDialog.OnDismissListener() { public void onDismiss(DialogInterface dialog) { donate.unbindServiceConn(); } }); donate.setAlert(alert); }
protected void launchChangelog() { ChangeLog changelog = new ChangeLog(this); View mChg = changelog.getView(); mChg.refreshDrawableState(); AlertDialog.Builder builder = new AlertDialog.Builder(Settings.this) .setTitle(R.string.changelog_title)