use of android.graphics.Outline in project Shuttle by timusus.
the class PlayPauseView method onSizeChanged.
@Override
protected void onSizeChanged(final int w, final int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
mDrawable.setBounds(0, 0, w, h);
mWidth = w;
mHeight = h;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
setOutlineProvider(new ViewOutlineProvider() {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void getOutline(View view, Outline outline) {
outline.setOval(0, 0, view.getWidth(), view.getHeight());
}
});
setClipToOutline(true);
}
}
use of android.graphics.Outline in project android_frameworks_base by AOSPA.
the class TaskView method onFinishInflate.
@Override
protected void onFinishInflate() {
// Bind the views
mHeaderView = (TaskViewHeader) findViewById(R.id.task_view_bar);
mThumbnailView = (TaskViewThumbnail) findViewById(R.id.task_view_thumbnail);
mThumbnailView.updateClipToTaskBar(mHeaderView);
mActionButtonView = findViewById(R.id.lock_to_app_fab);
mActionButtonView.setOutlineProvider(new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
// Set the outline to match the FAB background
outline.setOval(0, 0, mActionButtonView.getWidth(), mActionButtonView.getHeight());
outline.setAlpha(0.35f);
}
});
mActionButtonView.setOnClickListener(this);
mActionButtonTranslationZ = mActionButtonView.getTranslationZ();
}
use of android.graphics.Outline in project android_frameworks_base by AOSPA.
the class ViewGroup_Delegate method drawChild.
/**
* Overrides the original drawChild call in ViewGroup to draw the shadow.
*/
@LayoutlibDelegate
static /*package*/
boolean drawChild(ViewGroup thisVG, Canvas canvas, View child, long drawingTime) {
if (child.getZ() > thisVG.getZ()) {
// The background's bounds are set lazily. Make sure they are set correctly so that
// the outline obtained is correct.
child.setBackgroundBounds();
ViewOutlineProvider outlineProvider = child.getOutlineProvider();
Outline outline = child.mAttachInfo.mTmpOutline;
outlineProvider.getOutline(child, outline);
if (outline.mPath != null || (outline.mRect != null && !outline.mRect.isEmpty())) {
int restoreTo = transformCanvas(thisVG, canvas, child);
drawShadow(thisVG, canvas, child, outline);
canvas.restoreToCount(restoreTo);
}
}
return thisVG.drawChild_Original(canvas, child, drawingTime);
}
use of android.graphics.Outline in project android_frameworks_base by AOSPA.
the class View method rebuildOutline.
/**
* Internal version of {@link #invalidateOutline()} which invalidates the
* outline without invalidating the view itself. This is intended to be called from
* within methods in the View class itself which are the result of the view being
* invalidated already. For example, when we are drawing the background of a View,
* we invalidate the outline in case it changed in the meantime, but we do not
* need to invalidate the view because we're already drawing the background as part
* of drawing the view in response to an earlier invalidation of the view.
*/
private void rebuildOutline() {
// Unattached views ignore this signal, and outline is recomputed in onAttachedToWindow()
if (mAttachInfo == null)
return;
if (mOutlineProvider == null) {
// no provider, remove outline
mRenderNode.setOutline(null);
} else {
final Outline outline = mAttachInfo.mTmpOutline;
outline.setEmpty();
outline.setAlpha(1.0f);
mOutlineProvider.getOutline(this, outline);
mRenderNode.setOutline(outline);
}
}
use of android.graphics.Outline in project Hummingbird-for-Android by xiprox.
the class AnimeDetailsActivity method onCreate.
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
protected void onCreate(Bundle savedInstanceState) {
getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
Transition sharedElem = TransitionInflater.from(this).inflateTransition(R.transition.move_scale_transition);
getWindow().setSharedElementEnterTransition(sharedElem);
getWindow().setSharedElementExitTransition(sharedElem);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_anime_details);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mActionBar = getSupportActionBar();
api = new HummingbirdApi(this);
prefMan = new PrefManager(this);
mActionBar.setDisplayHomeAsUpEnabled(true);
anime = (Anime) getIntent().getSerializableExtra(ARG_ANIME_OBJ);
ANIME_ID = getIntent().getStringExtra(ARG_ID);
if (savedInstanceState != null) {
Anime savedAnime = (Anime) savedInstanceState.getSerializable(STATE_ANIME);
if (savedAnime != null)
anime = savedAnime;
LibraryEntry savedLibraryEntry = (LibraryEntry) savedInstanceState.getSerializable(STATE_LIBRARY_ENTRY);
if (savedLibraryEntry != null)
libraryEntry = savedLibraryEntry;
}
mActionBarBackgroundDrawable = new ColorDrawable(darkMutedColor != 0 ? darkMutedColor : getResources().getColor(R.color.neutral_darker));
mActionBarBackgroundDrawable.setAlpha(0);
toolbar.setBackgroundDrawable(mActionBarBackgroundDrawable);
mActionButton = (FloatingActionButton) findViewById(R.id.fab);
mQuickReturnView = toolbar;
mPlaceholderView = findViewById(R.id.placeholder);
mObservableScrollView = (ObservableScrollView) findViewById(R.id.anime_details_scroll_view);
mObservableScrollView.setCallbacks(this);
mObservableScrollView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
onScrollChanged(mObservableScrollView.getScrollY());
mMaxScrollY = mObservableScrollView.computeVerticalScrollRange() - mObservableScrollView.getHeight();
mQuickReturnHeight = mQuickReturnView.getHeight();
int headerHeight = mHeaderImage.getHeight();
if (!firstGlobalLayoutPerformed && headerHeight != 0) {
updateHeaderHeight(headerHeight);
firstGlobalLayoutPerformed = true;
}
}
});
mContentsHolder = (LinearLayout) findViewById(R.id.anime_details_content_holder);
mInfoHolder = (FrameLayout) findViewById(R.id.anime_details_info_holder);
mMoreInfoHolder = (LinearLayout) findViewById(R.id.anime_details_more_info_holder);
mLibraryInfoHolder = (LinearLayout) findViewById(R.id.anime_details_library_info_holder);
mHeaderHolder = (FrameLayout) findViewById(R.id.anime_details_header_holder);
mHeaderImage = (ImageView) findViewById(R.id.anime_details_header);
mCoverHolder = (FrameLayout) findViewById(R.id.anime_details_cover_image_holder);
mCoverImage = (ImageView) findViewById(R.id.anime_details_cover_image);
mTitle = (TextView) findViewById(R.id.anime_details_title);
mType = (TextView) findViewById(R.id.anime_details_type);
mGenre = (TextView) findViewById(R.id.anime_details_genres);
mEpisodeCount = (TextView) findViewById(R.id.anime_details_episode_count);
mEpisodeLength = (TextView) findViewById(R.id.anime_details_episode_duration);
mAgeRating = (TextView) findViewById(R.id.anime_details_age_rating);
mAired = (TextView) findViewById(R.id.anime_details_aired);
mCommunityRating = (TextView) findViewById(R.id.anime_details_community_rating);
mSynopsisHolder = (LinearLayout) findViewById(R.id.anime_details_synopsis_holder);
mSynopsis = (TextView) findViewById(R.id.anime_details_synopsis);
mMoreSimilarAnime = (LinearLayout) findViewById(R.id.anime_details_more_similar_anime);
mLibraryProgressBar = (ProgressBar) findViewById(R.id.anime_details_library_progress_bar);
mStatusSpinner = (Spinner) findViewById(R.id.anime_details_status_spinner);
mEpisodesHolder = (LinearLayout) findViewById(R.id.anime_details_library_episodes_holder);
mEpisodes = (TextView) findViewById(R.id.anime_details_library_episodes);
mRewatching = (SwitchCompat) findViewById(R.id.anime_details_library_rewatching);
mRewatchedTimesHolder = (LinearLayout) findViewById(R.id.anime_details_library_rewatched_holder);
mRewatchedTimes = (TextView) findViewById(R.id.anime_details_library_rewatched);
mPrivate = (SwitchCompat) findViewById(R.id.anime_details_library_private);
mRatingBar = (RatingBar) findViewById(R.id.anime_details_library_rating_advanced);
mSimpleRatingView = (SimpleRatingView) findViewById(R.id.anime_details_library_rating_simple);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ViewOutlineProvider infoOutlineProvider = new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
outline.setRect(0, Utils.dpToPx(AnimeDetailsActivity.this, getResources().getDimension(R.dimen.offset_details_info_card)), view.getWidth(), view.getHeight());
}
};
mInfoHolder.setOutlineProvider(infoOutlineProvider);
}
if (anime != null) {
displayAnimeInfo();
if (libraryEntry == null)
new LibraryEntryTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
else
displayLibraryElements();
} else
new AnimeInfoTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, true);
}
Aggregations