Skip to content

Commit

Permalink
Some javadoc explanations added to classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-vasiliev committed Apr 10, 2017
1 parent 990c9a8 commit cbbc89d
Show file tree
Hide file tree
Showing 14 changed files with 50 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import android.support.v4.view.ViewPager;
import android.view.View;

/**
* Page Transformer for main ViewPager.
*/
public class AlphaScalePageTransformer implements ViewPager.PageTransformer {

private static final float INACTIVE_SCALE = 0.8f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import android.graphics.Bitmap;
import android.util.LruCache;

/**
* LruCache for caching background bitmaps for {@link ECBackgroundSwitcherView}.
* Key is id of page from {@link ECPager} and value is background bitmap from provided data.
*/
public class BackgroundBitmapCache {
private final String TAG = "cache_manager";

private LruCache<Integer, Bitmap> mBackgroundsCache;

private static BackgroundBitmapCache instance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import android.graphics.BitmapFactory;

/**
* Bitmap Factory Options with inScaled flag disabled by default
*/
public class BitmapFactoryOptions extends BitmapFactory.Options {
public BitmapFactoryOptions() {
this.inScaled = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import android.os.AsyncTask;
import android.support.annotation.DrawableRes;

/**
* Worker for async processing bitmaps through cache {@link BackgroundBitmapCache}
*/
public class BitmapWorkerTask extends AsyncTask<Integer, Void, Bitmap> {

private final Resources mResources;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
import android.widget.ImageView;
import android.widget.ViewSwitcher;

/**
* Custom Image Switcher for display and change background images with some pretty animations.
* Uses different drawing orders for animation purposes.
*/
public class ECBackgroundSwitcherView extends ImageSwitcher {
private final int[] REVERSE_ORDER = new int[]{1, 0};
private final int[] NORMAL_ORDER = new int[]{0, 1};
Expand All @@ -41,7 +45,6 @@ public class ECBackgroundSwitcherView extends ImageSwitcher {

private BitmapWorkerTask mCurrentAnimationTask;


public ECBackgroundSwitcherView(Context context, AttributeSet attrs) {
super(context, attrs);
inflateAndInit(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@

import java.util.List;

/**
* Must be implemented to inflate card content list items layout.
*
* @param <T> Type of items in card content list
*/
public abstract class ECCardContentListItemAdapter<T> extends ArrayAdapter<T> {
private boolean zeroItemsMode = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

import java.util.List;

/**
* Implement this interface to provide data to pager view and content list inside pager card
*
* @param <T> Type of items in card content list
*/
public interface ECCardData<T> {

@DrawableRes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
import android.view.animation.DecelerateInterpolator;
import android.widget.FrameLayout;

/**
* Custom ViewPager used as main card pager, neighborhood elements are visible due to {@link ECPagerView},
* so this pager element used only inside {@link ECPagerView}. Also pager can change self position and size
* for animation purposes.
*/
public class ECPager extends ViewPager {
private int currentPosition;
private boolean pagingDisabled;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import android.view.ViewGroup;
import android.widget.FrameLayout;

/**
* Pager Card it's simple container that wraps card content list and some logic for work with animations.
*/
public class ECPagerCard extends FrameLayout {

private ECPagerCardContentList ecPagerCardContentList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
import android.widget.ListAdapter;
import android.widget.ListView;

/**
* Card content list it's main element of card content - just a list view with custom header and animations.
*/
public class ECPagerCardContentList extends ListView {

private boolean scrollDisabled;
Expand Down Expand Up @@ -50,7 +53,7 @@ public ECCardContentListItemAdapter getContentListItemAdapter() {
@Override
public void setAdapter(ListAdapter adapter) {
super.setAdapter(adapter);
if (adapter instanceof ECCardContentListItemAdapter){
if (adapter instanceof ECCardContentListItemAdapter) {
this.contentListItemAdapter = (ECCardContentListItemAdapter) adapter;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@

import ramotion.com.expandingcollection.R;

/**
* View used to be a card head that is visible when card is collapsed. Just frame layout with background image
* and logic for animate height.
*/
public class ECPagerCardHead extends FrameLayout {

private ImageView headBackgroundImageView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

import ramotion.com.expandingcollection.R;

/**
* Root PagerView element. Wraps all logic and behavior.
*/
public class ECPagerView extends FrameLayout implements ViewPager.OnPageChangeListener {
private ECPager pager;
private ECBackgroundSwitcherView attachedImageSwitcher;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@

import static android.R.attr.bitmap;

/**
* Adapter must be implemented to provide your layouts and data(that implements {@link ECCardData})
* to cards in {@link ECPagerView}.
*/
public abstract class ECPagerViewAdapter extends PagerAdapter {

private ECPagerCard activeCard;
Expand Down
Empty file modified gradlew
100644 → 100755
Empty file.

0 comments on commit cbbc89d

Please sign in to comment.