下面列出了android.view.View#refreshDrawableState ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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);
}
private void thumbNailScaleAnimation(View view) {
view.setDrawingCacheEnabled(true);
view.setPressed(false);
view.refreshDrawableState();
Bitmap bitmap = view.getDrawingCache();
ActivityOptionsCompat opts = ActivityOptionsCompat.makeThumbnailScaleUpAnimation(
view, bitmap, 0, 0);
// Request the activity be started, using the custom animation options.
startActivity(new Intent(MainNormalActivity.this, AppsPreferencesActivity.class),
opts.toBundle());
view.setDrawingCacheEnabled(false);
}
private void thumbNailScaleAnimation(View view) {
view.setDrawingCacheEnabled(true);
view.setPressed(false);
view.refreshDrawableState();
Bitmap bitmap = view.getDrawingCache();
ActivityOptionsCompat opts = ActivityOptionsCompat.makeThumbnailScaleUpAnimation(
view, bitmap, 0, 0);
// Request the activity be started, using the custom animation options.
startActivity(new Intent(MainServiceActivity.this, AppsPreferencesActivity.class),
opts.toBundle());
view.setDrawingCacheEnabled(false);
}
public void setOffset(View view, int offset, int minOffset) {
offset = Math.max(minOffset, offset);
if (offset > 105) {
view.refreshDrawableState();
}
if (view.getTranslationY() != offset) {
view.setTranslationY(offset);
ViewCompat.postInvalidateOnAnimation(view);
}
}
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();
}