// Starts the fling animation. Called both as a response to a fling gesture and as via the // public WebView#flingScroll(int, int) API. public void flingScroll(int velocityX, int velocityY) { final int scrollX = mDelegate.getContainerViewScrollX(); final int scrollY = mDelegate.getContainerViewScrollY(); final int rangeX = computeMaximumHorizontalScrollOffset(); final int rangeY = computeMaximumVerticalScrollOffset(); mScroller.fling(scrollX, scrollY, velocityX, velocityY, 0, rangeX, 0, rangeY); mDelegate.invalidate(); }
void setActionBarUpIndicator(Drawable upDrawable, int contentDescRes) { if (!mWarnedForDisplayHomeAsUp && !mActivityImpl.isNavigationVisible()) { Log.w( "ActionBarDrawerToggle", "DrawerToggle may not show up because NavigationIcon" + " is not visible. You may need to call " + "actionbar.setDisplayHomeAsUpEnabled(true);"); mWarnedForDisplayHomeAsUp = true; } mActivityImpl.setActionBarUpIndicator(upDrawable, contentDescRes); }
/** * Returns a newly allocated Session object from the given Properties * * @param properties a <code>Properties</code> value * @return a <code>javax.mail.Session</code> value initialized from the given properties */ public javax.mail.Session newSessionForContext(Properties properties, String contextString) { if (_delegate != null) { _delegate.willCreateSessionWithPropertiesForContext(properties, contextString); } javax.mail.Session session = javax.mail.Session.getInstance(properties); if (_delegate != null) { _delegate.didCreateSession(session); } session.setDebug(debugEnabled()); return session; }
private void scrollBy(int deltaX, int deltaY) { if (deltaX == 0 && deltaY == 0) return; final int scrollX = mDelegate.getContainerViewScrollX(); final int scrollY = mDelegate.getContainerViewScrollY(); final int scrollRangeX = computeMaximumHorizontalScrollOffset(); final int scrollRangeY = computeMaximumVerticalScrollOffset(); // The android.view.View.overScrollBy method is used for both scrolling and over-scrolling // which is why we use it here. mDelegate.overScrollContainerViewBy( deltaX, deltaY, scrollX, scrollY, scrollRangeX, scrollRangeY, mProcessingTouchEvent); }
// Called by the View system as a response to the mDelegate.overScrollContainerViewBy call. public void onContainerViewOverScrolled( int scrollX, int scrollY, boolean clampedX, boolean clampedY) { // Clamp the scroll offset at (0, max). scrollX = clampHorizontalScroll(scrollX); scrollY = clampVerticalScroll(scrollY); mDelegate.scrollContainerViewTo(scrollX, scrollY); // This is only necessary if the containerView scroll offset ends up being different // than the one set from native in which case we want the value stored on the native side // to reflect the value stored in the containerView (and not the other way around). scrollNativeTo(mDelegate.getContainerViewScrollX(), mDelegate.getContainerViewScrollY()); }
@Override public void setZip(String zip) { s.zip = zip; if (delegate != null) { delegate.zipWasSet(this, zip); } }
public void readDelegate(Delegate delegate) { Reader reader = InputStreamReader( delegate.stream()); // Compliant since obtained stream can be closed elsewhere, and thus // reader reader.read(); }
Drawable getThemeUpIndicator() { if (mActivityImpl != null) { return mActivityImpl.getThemeUpIndicator(); } else { return IMPL.getThemeUpIndicator(mActivity); } }
// Called by the native side to attempt to scroll the container view. public void scrollContainerViewTo(int x, int y) { mNativeScrollX = x; mNativeScrollY = y; final int scrollX = mDelegate.getContainerViewScrollX(); final int scrollY = mDelegate.getContainerViewScrollY(); final int deltaX = x - scrollX; final int deltaY = y - scrollY; final int scrollRangeX = computeMaximumHorizontalScrollOffset(); final int scrollRangeY = computeMaximumVerticalScrollOffset(); // We use overScrollContainerViewBy to be compatible with WebViewClassic which used this // method for handling both over-scroll as well as in-bounds scroll. mDelegate.overScrollContainerViewBy( deltaX, deltaY, scrollX, scrollY, scrollRangeX, scrollRangeY, mProcessingTouchEvent); }
@Override public void setCampaign(String campaign) { s.campaign = campaign; if (delegate != null) { delegate.campaignWasSet(this, campaign); } }
@Override public void setChannel(String channel) { s.channel = channel; if (delegate != null) { delegate.channelWasSet(this, channel); } }
@Override public void setState(String state) { s.state = state; if (delegate != null) { delegate.stateWasSet(this, state); } }
@Override public void setIdentifier(String identifier) { s.visitorID = identifier; if (delegate != null) { delegate.identifierWasSet(this, identifier); } }
@Override public void setGlobalParameters(Map<Object, Object> globalParameters) { this.globalParameters = globalParameters == null ? null : stringHashtable(globalParameters); this.globalParameters = stringHashtable(globalParameters); if (delegate != null) { delegate.globalParametersWasSet(this, globalParameters); } }
//////////////////////////////////////// // Touch Handling //////////////////////////////////////// @Override protected boolean onTap(int index) { Log.v(TAG, "onTap(" + index + ")"); if (mDelegate != null) { // mDelegate.venueOverlayTappedItem(index); mDelegate.venueOverlayTappedItem(mOverlays.get(index)); } return true; }
void setActionBarDescription(int i) { if (mActivityImpl != null) { mActivityImpl.setActionBarDescription(i); return; } else { mSetIndicatorInfo = IMPL.setActionBarDescription(mSetIndicatorInfo, mActivity, i); return; } }
void setActionBarUpIndicator(Drawable drawable, int i) { if (mActivityImpl != null) { mActivityImpl.setActionBarUpIndicator(drawable, i); return; } else { mSetIndicatorInfo = IMPL.setActionBarUpIndicator(mSetIndicatorInfo, mActivity, drawable, i); return; } }
/** * True if {@code obj} is itself a {@code JSProxyObject} with the same value for {@link * #getDelegate()}. */ @NonNullByDefault(false) @Override public boolean equals(Object obj) { if (obj instanceof JSProxyObject<?>) { obj = ((JSProxyObject<?>) obj).getDelegate(); } return _delegate.equals(obj); }
@Override public void removeGlobalParameter(Object key) { if (this.globalParameters != null) { this.globalParameters.remove(key); if (delegate != null) { delegate.globalParametersWasSet(this, objectMap(this.globalParameters)); } } }
@Override public void setGlobalParameter(Object key, Object object) { if (this.globalParameters == null) { this.globalParameters = new Hashtable<String, String>(); } this.globalParameters.put(key.toString(), object.toString()); if (delegate != null) { delegate.globalParametersWasSet(this, objectMap(this.globalParameters)); } }
private static <T> Field<T> createCollectionInlineV( int number, String name, final java.lang.reflect.Field f, final MessageFactory messageFactory, final Delegate<Object> inline) { return new Field<T>(inline.getFieldType(), number, name, true, f.getAnnotation(Tag.class)) { { f.setAccessible(true); } @SuppressWarnings("unchecked") protected void mergeFrom(Input input, T message) throws IOException { final Object value = inline.readFrom(input); try { final Collection<Object> existing = (Collection<Object>) f.get(message); if (existing == null) { final Collection<Object> collection = messageFactory.newMessage(); collection.add(value); f.set(message, collection); } else existing.add(value); } catch (IllegalArgumentException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } @SuppressWarnings("unchecked") protected void writeTo(Output output, T message) throws IOException { final Collection<Object> collection; try { collection = (Collection<Object>) f.get(message); } catch (IllegalArgumentException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } if (collection != null && !collection.isEmpty()) { for (Object o : collection) { if (o != null) inline.writeTo(output, number, o, true); } } } protected void transfer(Pipe pipe, Input input, Output output, boolean repeated) throws IOException { inline.transfer(pipe, input, output, number, repeated); } }; }
// Called immediately before the draw to update the scroll offset. public void computeScrollAndAbsorbGlow(OverScrollGlow overScrollGlow) { final boolean stillAnimating = mScroller.computeScrollOffset(); if (!stillAnimating) return; final int oldX = mDelegate.getContainerViewScrollX(); final int oldY = mDelegate.getContainerViewScrollY(); int x = mScroller.getCurrX(); int y = mScroller.getCurrY(); int rangeX = computeMaximumHorizontalScrollOffset(); int rangeY = computeMaximumVerticalScrollOffset(); if (overScrollGlow != null) { overScrollGlow.absorbGlow(x, y, oldX, oldY, rangeX, rangeY, mScroller.getCurrVelocity()); } // The mScroller is configured not to go outside of the scrollable range, so this call // should never result in attempting to scroll outside of the scrollable region. scrollBy(x - oldX, y - oldY); mDelegate.invalidate(); }
@UiHandler("okBtn") public void okBtnClicked(ClickEvent event) { Log.info("Event :" + event.getAssociatedType()); // event.getAssociatedType() EntityProxy object = listBox.getValue(); Log.info("okBtnClicked :" + object); if (object instanceof StandardizedRoleProxy) { Log.info("StandardizedRoleProxy"); delegate.saveStandardizedRole(this); } }
private void showReplacementPreview() { hideBalloon(); final FindResult cursor = mySearchResults.getCursor(); final Editor editor = mySearchResults.getEditor(); if (myDelegate != null && cursor != null) { String replacementPreviewText = myDelegate.getStringToReplace(editor, cursor); if (StringUtil.isEmpty(replacementPreviewText)) { replacementPreviewText = EMPTY_STRING_DISPLAY_TEXT; } final FindModel findModel = mySearchResults.getFindModel(); if (findModel.isRegularExpressions() && findModel.isReplaceState()) { showBalloon(cursor, editor, replacementPreviewText); } } }
protected void writeEventStream(Payload payload) throws IOException { PrintStream printStream = new PrintStream(response.outputStream()); try (Stream<?> stream = (Stream<?>) payload.rawContent()) { stream.forEach( item -> { String jsonOrPlainString = (item instanceof String) ? (String) item : TypeConvert.toJson(item); printStream .append("data: ") .append(jsonOrPlainString.replaceAll("[\n]", "\ndata: ")) .append("\n\n") .flush(); }); } }
/** * In the future, we can make this constructor public if we want to let developers customize the * animation. */ <T extends Drawable & DrawerToggle> ActionBarDrawerToggle( Activity activity, Toolbar toolbar, DrawerLayout drawerLayout, T slider, @StringRes int openDrawerContentDescRes, @StringRes int closeDrawerContentDescRes) { if (toolbar != null) { mActivityImpl = new ToolbarCompatDelegate(toolbar); toolbar.setNavigationOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (mDrawerIndicatorEnabled) { toggle(); } else if (mToolbarNavigationClickListener != null) { mToolbarNavigationClickListener.onClick(v); } } }); } else if (activity instanceof DelegateProvider) { // Allow the Activity to provide an impl mActivityImpl = ((DelegateProvider) activity).getDrawerToggleDelegate(); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { mActivityImpl = new JellybeanMr2Delegate(activity); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mActivityImpl = new HoneycombDelegate(activity); } else { mActivityImpl = new DummyDelegate(activity); } mDrawerLayout = drawerLayout; mOpenDrawerContentDescRes = openDrawerContentDescRes; mCloseDrawerContentDescRes = closeDrawerContentDescRes; if (slider == null) { mSlider = new DrawerArrowDrawableToggle(activity, mActivityImpl.getActionBarThemedContext()); } else { mSlider = slider; } mHomeAsUpIndicator = getThemeUpIndicator(); }
private void scrollNativeTo(int x, int y) { x = clampHorizontalScroll(x); y = clampVerticalScroll(y); // We shouldn't do the store to native while processing a touch event since that confuses // the gesture processing logic. if (mProcessingTouchEvent) { mDeferredNativeScrollX = x; mDeferredNativeScrollY = y; mApplyDeferredNativeScroll = true; return; } if (x == mNativeScrollX && y == mNativeScrollY) return; // The scrollNativeTo call should be a simple store, so it's OK to assume it always // succeeds. mNativeScrollX = x; mNativeScrollY = y; mDelegate.scrollNativeTo(x, y); }
@Override public void setGender(LolayTrackerGender gender) { if (delegate != null) { delegate.setGender(this, gender); } }
@Override public void setAge(int age) { if (delegate != null) { delegate.setAge(this, age); } }
@Override public void setVersion(String version) { if (delegate != null) { delegate.setVersion(this, version); } }