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
package com.myfab5.mobile.myfab5.ui.helpers.customcomponents; | |
import android.content.Context; | |
import android.support.v4.view.MotionEventCompat; | |
import android.support.v4.widget.SwipeRefreshLayout; | |
import android.util.AttributeSet; | |
import android.view.MotionEvent; | |
/** | |
* A class that lets an activity know when the SwipeRefreshLayout has |
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
import com.google.gson.Gson; | |
import com.google.gson.GsonBuilder; | |
import org.w3c.dom.Document; | |
import org.w3c.dom.Element; | |
import org.w3c.dom.Node; | |
import org.w3c.dom.NodeList; | |
import java.io.File; | |
import java.text.DateFormat; |
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
package com.tunjid.demo.Util; | |
import android.content.Context; | |
import android.graphics.Canvas; | |
import android.graphics.Paint; | |
import android.graphics.Rect; | |
import android.graphics.Typeface; | |
import android.graphics.drawable.Drawable; | |
import android.support.annotation.ColorRes; | |
import android.support.annotation.DrawableRes; |
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 void setExtended(boolean extended, boolean force) { | |
if (isAnimating || (extended && isExtended() && !force)) return; | |
ConstraintSet set = new ConstraintSet(); | |
set.clone(container.getContext(), extended ? R.layout.fab_extended : R.layout.fab_collapsed); | |
TransitionManager.beginDelayedTransition(container, new AutoTransition() | |
.addListener(listener).setDuration(150)); | |
if (extended) button.setText(currentText); |
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
package com.mainstreetcode.teammate.util; | |
import android.animation.AnimatorSet; | |
import android.animation.ObjectAnimator; | |
import android.support.annotation.DrawableRes; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.Nullable; | |
import android.support.annotation.StringRes; | |
import android.support.constraint.ConstraintLayout; | |
import android.support.constraint.ConstraintSet; |
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
package com.mainstreetcode.teammate.util; | |
import android.content.Context; | |
import android.support.annotation.NonNull; | |
import android.support.design.widget.CoordinatorLayout; | |
import android.support.design.widget.Snackbar; | |
import android.support.v4.view.ViewCompat; | |
import android.support.v4.view.animation.FastOutSlowInInterpolator; | |
import android.util.AttributeSet; | |
import android.view.View; |
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
ViewPagerIndicatorAnimator indicatorAnimator = ViewPagerIndicatorAnimator.builder() | |
.setIndicatorWidth(indicatorSize) | |
.setIndicatorHeight(indicatorSize) | |
.setIndicatorPadding(indicatorPadding)) | |
.setInActiveDrawable(R.drawable.ic_circle_24dp) | |
.setActiveDrawable(R.drawable.ic_doggo_24dp) | |
.setGuideLine(root.findViewById(R.id.guide)) | |
.setContainer((ConstraintLayout) root) | |
.setViewPager(viewPager) | |
.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
@FunctionalInterface | |
public interface IndicatorWatcher { | |
void onIndicatorMoved(ImageView indicator, int position, float fraction, float totalTranslation); | |
} |
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
animator.addIndicatorWatcher((indicator, position, fraction, totalTranslation) -> { | |
double radians = Math.PI * fraction; | |
float sine = (float) -Math.sin(radians); | |
float cosine = (float) Math.cos(radians); | |
float maxScale = Math.max(Math.abs(cosine), 0.4F); | |
ImageView currentIndicator = animator.getIndicatorAt(position); | |
currentIndicator.setScaleX(maxScale); | |
currentIndicator.setScaleY(maxScale); |
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 class Animator extends DataSetObserver implements OnPageChangeListener, OnAdapterChangeListener, OnGlobalLayoutListener { | |
private float lastPositionOffset; | |
private Animator() { | |
PagerAdapter adapter = viewPager.getAdapter(); | |
if (adapter != null) adapter.registerDataSetObserver(this); | |
viewPager.addOnPageChangeListener(this); | |
viewPager.addOnAdapterChangeListener(this); |
OlderNewer