use of android.support.annotation.CallSuper in project remusic by aa112901.
the class RoundViewPager method onPageScrolled.
/**
* This method will be invoked when the currentPosition page is scrolled, either as part
* of a programmatically initiated smooth scroll or a user initiated touch scroll.
* If you override this method you must call through to the superclass implementation
* (e.g. super.onPageScrolled(position, offset, offsetPixels)) before onPageScrolled
* returns.
*
* @param position Position index of the first page currently being displayed.
* Page position+1 will be visible if positionOffset is nonzero.
* @param offset Value from [0, 1) indicating the offset from the page at position.
* @param offsetPixels Value in pixels indicating the offset from position.
*/
@CallSuper
protected void onPageScrolled(int position, float offset, int offsetPixels) {
// Offset any decor views if needed - keep them on-screen at all times.
if (mDecorChildCount > 0) {
final int scrollX = getScrollX();
int paddingLeft = getPaddingLeft();
int paddingRight = getPaddingRight();
final int width = getWidth();
final int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
final View child = getChildAt(i);
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
if (!lp.isDecor)
continue;
final int hgrav = lp.gravity & Gravity.HORIZONTAL_GRAVITY_MASK;
int childLeft = 0;
switch(hgrav) {
default:
childLeft = paddingLeft;
break;
case Gravity.LEFT:
childLeft = paddingLeft;
paddingLeft += child.getWidth();
break;
case Gravity.CENTER_HORIZONTAL:
childLeft = Math.max((width - child.getMeasuredWidth()) / 2, paddingLeft);
break;
case Gravity.RIGHT:
childLeft = width - paddingRight - child.getMeasuredWidth();
paddingRight += child.getMeasuredWidth();
break;
}
childLeft += scrollX;
final int childOffset = childLeft - child.getLeft();
if (childOffset != 0) {
child.offsetLeftAndRight(childOffset);
}
}
}
dispatchOnPageScrolled(position, offset, offsetPixels);
if (mPageTransformer != null) {
final int scrollX = getScrollX();
final int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
final View child = getChildAt(i);
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
if (lp.isDecor)
continue;
final float transformPos = (float) (child.getLeft() - scrollX) / getClientWidth();
mPageTransformer.transformPage(child, transformPos);
}
}
mCalledSuper = true;
}
use of android.support.annotation.CallSuper in project android_frameworks_base by ResurrectionRemix.
the class BaseActivity method onCreate.
@CallSuper
@Override
public void onCreate(Bundle icicle) {
// Record the time when onCreate is invoked for metric.
mStartTime = new Date().getTime();
super.onCreate(icicle);
final Intent intent = getIntent();
addListenerForLaunchCompletion();
setContentView(mLayoutId);
mDrawer = DrawerController.create(this);
mState = getState(icicle);
Metrics.logActivityLaunch(this, mState, intent);
mRoots = DocumentsApplication.getRootsCache(this);
getContentResolver().registerContentObserver(RootsCache.sNotificationUri, false, mRootsCacheObserver);
mSearchManager = new SearchViewManager(this, icicle);
DocumentsToolbar toolbar = (DocumentsToolbar) findViewById(R.id.toolbar);
setActionBar(toolbar);
mNavigator = new NavigationView(mDrawer, toolbar, (Spinner) findViewById(R.id.stack), mState, this);
// Base classes must update result in their onCreate.
setResult(Activity.RESULT_CANCELED);
}
use of android.support.annotation.CallSuper in project ride-read-android by Ride-Read.
the class RecyclerViewHeader method onTouchEvent.
@Override
@CallSuper
public boolean onTouchEvent(@NonNull MotionEvent event) {
if (recyclerWantsTouch) {
// this cannot be true if recycler is not attached
int scrollDiff = downTranslation - calculateTranslation();
int verticalDiff = isVertical ? scrollDiff : 0;
int horizontalDiff = isVertical ? 0 : scrollDiff;
MotionEvent recyclerEvent = MotionEvent.obtain(event.getDownTime(), event.getEventTime(), event.getAction(), event.getX() - horizontalDiff, event.getY() - verticalDiff, event.getMetaState());
recyclerView.onTouchEvent(recyclerEvent);
return false;
}
return super.onTouchEvent(event);
}
use of android.support.annotation.CallSuper in project ChipsLayoutManager by BelooS.
the class AbstractLayouter method placeView.
@Override
@CallSuper
public final /** calculate view positions, view won't be actually added to layout when calling this method
* @return true if view successfully placed, false if view can't be placed because out of space on screen and have to be recycled */
boolean placeView(View view) {
layoutManager.measureChildWithMargins(view, 0, 0);
calculateView(view);
if (canNotBePlacedInCurrentRow()) {
isRowCompleted = true;
layoutRow();
}
if (isFinishedLayouting())
return false;
rowSize++;
Rect rect = createViewRect(view);
rowViews.add(new Pair<>(rect, view));
return true;
}
use of android.support.annotation.CallSuper in project AntennaPod by AntennaPod.
the class CastEnabledActivity method onPrepareOptionsMenu.
@Override
@CallSuper
public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
MenuItem mediaRouteButton = menu.findItem(R.id.media_route_menu_item);
if (mediaRouteButton == null) {
Log.wtf(TAG, "MediaRoute item could not be found on the menu!", new Exception());
mediaRouteActionProvider = null;
return true;
}
mediaRouteActionProvider = castManager.addMediaRouterButton(mediaRouteButton);
if (mediaRouteActionProvider != null) {
mediaRouteActionProvider.setEnabled(castButtonVisibilityManager.shouldEnable());
}
return true;
}
Aggregations