This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
springForce = SpringForce(0f) | |
relative_layout.pivotX = 0f | |
relative_layout.pivotY = 0f | |
val springAnim = SpringAnimation(relative_layout, DynamicAnimation.ROTATION).apply { | |
springForce.dampingRatio = SpringForce.DAMPING_RATIO_HIGH_BOUNCY | |
springForce.stiffness = SpringForce.STIFFNESS_VERY_LOW | |
} | |
springAnim.spring = springForce | |
springAnim.setStartValue(80f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
springAnim.addEndListener(object : DynamicAnimation.OnAnimationEndListener { | |
override fun onAnimationEnd(animation: DynamicAnimation<out DynamicAnimation<*>>?, | |
canceled: Boolean, value: Float, velocity: Float) { | |
//Translation code will be here | |
}) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onAnimationEnd(animation: DynamicAnimation<out DynamicAnimation<*>>?, canceled: Boolean, value: Float, velocity: Float) { | |
val displayMetrics = DisplayMetrics() | |
windowManager.defaultDisplay.getMetrics(displayMetrics) | |
val height = displayMetrics.heightPixels.toFloat() | |
val width = displayMetrics.widthPixels | |
relative_layout.animate() | |
.setStartDelay(1) | |
.translationXBy(width.toFloat() / 2) | |
.translationYBy(height) | |
.setListener(object : Animator.AnimatorListener { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun setupApollo(): ApolloClient { | |
val okHttp = OkHttpClient | |
.Builder() | |
.addInterceptor({ chain -> | |
val original = chain.request() | |
val builder = original.newBuilder().method(original.method(), | |
original.body()) | |
builder.addHeader("Authorization" | |
, "Bearer " + BuildConfig.AUTH_TOKEN) | |
chain.proceed(builder.build()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
client=setupApollo() | |
client.query(FindQuery //From the auto generated class | |
.builder() | |
.name(repo_name_edittext.text.toString()) //Passing required arguments | |
.owner(owner_name_edittext.text.toString()) //Passing required arguments | |
.build()) | |
.enqueue(object : ApolloCall.Callback<FindQuery.Data>() { | |
override fun onFailure(e: ApolloException) { | |
Log.info(e.message.toString()) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handler.postDelayed(new Runnable() { | |
@Override | |
public void run() { | |
if (index < polyLineList.size() - 1) { | |
index++; | |
next = index + 1; | |
} | |
if (index < polyLineList.size() - 1) { | |
startPosition = polyLineList.get(index); | |
endPosition = polyLineList.get(next); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
v = valueAnimator.getAnimatedFraction(); | |
lng = v * endPosition.longitude + (1 - v)* startPosition.longitude; | |
lat = v * endPosition.latitude + (1 - v)* startPosition.latitude; | |
LatLng newPos = new LatLng(lat, lng); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
marker.setPosition(newPos); | |
marker.setAnchor(0.5f, 0.5f); | |
marker.setRotation(getBearing(startPosition, newPos)); | |
mMap.animateCamera(CameraUpdateFactory | |
.newCameraPosition(new CameraPosition.Builder().target(newPos).zoom(15.5f).build())); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void setOnJourneyBegin(Object journeyEvent) { | |
subject.onNext(journeyEvent); | |
} | |
public Observable<Object> getOnJourneyEvent() { | |
return subject; | |
} | |
public void setOnJourneyEnd(Object journeyEvent) { | |
subject.onNext(journeyEvent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Begin of the journey when index of LatLng in list will be 0. | |
**/ | |
if (index == 0) { | |
BeginJourneyEvent beginJourneyEvent = new BeginJourneyEvent(); | |
beginJourneyEvent.setBeginLatLng(startPosition); | |
JourneyEventBus.getInstance().setOnJourneyBegin(beginJourneyEvent); | |
} | |
/** | |
End of the journey when index of LatLng in list will be last that is size()-1. |
OlderNewer